aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/tipc/port.c25
1 files changed, 9 insertions, 16 deletions
diff --git a/net/tipc/port.c b/net/tipc/port.c
index 0bd3e6192c43..4dfef9e798e3 100644
--- a/net/tipc/port.c
+++ b/net/tipc/port.c
@@ -841,14 +841,14 @@ static void port_dispatcher_sigh(void *dummy)
841 u32 peer_node = port_peernode(p_ptr); 841 u32 peer_node = port_peernode(p_ptr);
842 842
843 tipc_port_unlock(p_ptr); 843 tipc_port_unlock(p_ptr);
844 if (unlikely(!cb))
845 goto reject;
844 if (unlikely(!connected)) { 846 if (unlikely(!connected)) {
845 if (tipc_connect2port(dref, &orig)) 847 if (tipc_connect2port(dref, &orig))
846 goto reject; 848 goto reject;
847 } else if ((msg_origport(msg) != peer_port) || 849 } else if ((msg_origport(msg) != peer_port) ||
848 (msg_orignode(msg) != peer_node)) 850 (msg_orignode(msg) != peer_node))
849 goto reject; 851 goto reject;
850 if (unlikely(!cb))
851 goto reject;
852 if (unlikely(++p_ptr->publ.conn_unacked >= 852 if (unlikely(++p_ptr->publ.conn_unacked >=
853 TIPC_FLOW_CONTROL_WIN)) 853 TIPC_FLOW_CONTROL_WIN))
854 tipc_acknowledge(dref, 854 tipc_acknowledge(dref,
@@ -862,9 +862,7 @@ static void port_dispatcher_sigh(void *dummy)
862 tipc_msg_event cb = up_ptr->msg_cb; 862 tipc_msg_event cb = up_ptr->msg_cb;
863 863
864 tipc_port_unlock(p_ptr); 864 tipc_port_unlock(p_ptr);
865 if (unlikely(connected)) 865 if (unlikely(!cb || connected))
866 goto reject;
867 if (unlikely(!cb))
868 goto reject; 866 goto reject;
869 skb_pull(buf, msg_hdr_sz(msg)); 867 skb_pull(buf, msg_hdr_sz(msg));
870 cb(usr_handle, dref, &buf, msg_data(msg), 868 cb(usr_handle, dref, &buf, msg_data(msg),
@@ -877,11 +875,7 @@ static void port_dispatcher_sigh(void *dummy)
877 tipc_named_msg_event cb = up_ptr->named_msg_cb; 875 tipc_named_msg_event cb = up_ptr->named_msg_cb;
878 876
879 tipc_port_unlock(p_ptr); 877 tipc_port_unlock(p_ptr);
880 if (unlikely(connected)) 878 if (unlikely(!cb || connected || !published))
881 goto reject;
882 if (unlikely(!cb))
883 goto reject;
884 if (unlikely(!published))
885 goto reject; 879 goto reject;
886 dseq.type = msg_nametype(msg); 880 dseq.type = msg_nametype(msg);
887 dseq.lower = msg_nameinst(msg); 881 dseq.lower = msg_nameinst(msg);
@@ -908,11 +902,10 @@ err:
908 u32 peer_node = port_peernode(p_ptr); 902 u32 peer_node = port_peernode(p_ptr);
909 903
910 tipc_port_unlock(p_ptr); 904 tipc_port_unlock(p_ptr);
911 if (!connected || !cb) 905 if (!cb || !connected)
912 break;
913 if (msg_origport(msg) != peer_port)
914 break; 906 break;
915 if (msg_orignode(msg) != peer_node) 907 if ((msg_origport(msg) != peer_port) ||
908 (msg_orignode(msg) != peer_node))
916 break; 909 break;
917 tipc_disconnect(dref); 910 tipc_disconnect(dref);
918 skb_pull(buf, msg_hdr_sz(msg)); 911 skb_pull(buf, msg_hdr_sz(msg));
@@ -924,7 +917,7 @@ err:
924 tipc_msg_err_event cb = up_ptr->err_cb; 917 tipc_msg_err_event cb = up_ptr->err_cb;
925 918
926 tipc_port_unlock(p_ptr); 919 tipc_port_unlock(p_ptr);
927 if (connected || !cb) 920 if (!cb || connected)
928 break; 921 break;
929 skb_pull(buf, msg_hdr_sz(msg)); 922 skb_pull(buf, msg_hdr_sz(msg));
930 cb(usr_handle, dref, &buf, msg_data(msg), 923 cb(usr_handle, dref, &buf, msg_data(msg),
@@ -937,7 +930,7 @@ err:
937 up_ptr->named_err_cb; 930 up_ptr->named_err_cb;
938 931
939 tipc_port_unlock(p_ptr); 932 tipc_port_unlock(p_ptr);
940 if (connected || !cb) 933 if (!cb || connected)
941 break; 934 break;
942 dseq.type = msg_nametype(msg); 935 dseq.type = msg_nametype(msg);
943 dseq.lower = msg_nameinst(msg); 936 dseq.lower = msg_nameinst(msg);