Skip to content

Commit 9871b27

Browse files
Erik Hugnedavem330
Erik Hugne
authored andcommitted
tipc: fix random link reset problem
In the function tipc_sk_rcv(), the stack variable 'err' is only initialized to TIPC_ERR_NO_PORT for the first iteration over the link input queue. If a chain of messages are received from a link, failure to lookup the socket for any but the first message will cause the message to bounce back out on a random link. We fix this by properly initializing err. Signed-off-by: Erik Hugne <[email protected]> Signed-off-by: Jon Maloy <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent def81f6 commit 9871b27

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/tipc/socket.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1764,13 +1764,14 @@ static int tipc_sk_enqueue(struct sk_buff_head *inputq, struct sock *sk,
17641764
int tipc_sk_rcv(struct net *net, struct sk_buff_head *inputq)
17651765
{
17661766
u32 dnode, dport = 0;
1767-
int err = -TIPC_ERR_NO_PORT;
1767+
int err;
17681768
struct sk_buff *skb;
17691769
struct tipc_sock *tsk;
17701770
struct tipc_net *tn;
17711771
struct sock *sk;
17721772

17731773
while (skb_queue_len(inputq)) {
1774+
err = -TIPC_ERR_NO_PORT;
17741775
skb = NULL;
17751776
dport = tipc_skb_peek_port(inputq, dport);
17761777
tsk = tipc_sk_lookup(net, dport);

0 commit comments

Comments
 (0)