Commit 9871b27f authored by Erik Hugne's avatar Erik Hugne Committed by David S. Miller

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: default avatarErik Hugne <erik.hugne@ericsson.com>
Signed-off-by: default avatarJon Maloy <jon.maloy@ericsson.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent def81f69
...@@ -1764,13 +1764,14 @@ static int tipc_sk_enqueue(struct sk_buff_head *inputq, struct sock *sk, ...@@ -1764,13 +1764,14 @@ static int tipc_sk_enqueue(struct sk_buff_head *inputq, struct sock *sk,
int tipc_sk_rcv(struct net *net, struct sk_buff_head *inputq) int tipc_sk_rcv(struct net *net, struct sk_buff_head *inputq)
{ {
u32 dnode, dport = 0; u32 dnode, dport = 0;
int err = -TIPC_ERR_NO_PORT; int err;
struct sk_buff *skb; struct sk_buff *skb;
struct tipc_sock *tsk; struct tipc_sock *tsk;
struct tipc_net *tn; struct tipc_net *tn;
struct sock *sk; struct sock *sk;
while (skb_queue_len(inputq)) { while (skb_queue_len(inputq)) {
err = -TIPC_ERR_NO_PORT;
skb = NULL; skb = NULL;
dport = tipc_skb_peek_port(inputq, dport); dport = tipc_skb_peek_port(inputq, dport);
tsk = tipc_sk_lookup(net, dport); tsk = tipc_sk_lookup(net, dport);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment