Skip to content

Commit

Permalink
tipc: fix node reference count bug
Browse files Browse the repository at this point in the history
Commit 5405ff6 ("tipc: convert node lock to rwlock")
introduced a bug to the node reference counter handling. When a
message is successfully sent in the function tipc_node_xmit(),
we return directly after releasing the node lock, instead of
continuing and decrementing the node reference counter as we
should do.

This commit fixes this bug.

Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Jon Paul Maloy authored and David S. Miller committed Dec 3, 2015
1 parent b69e3c6 commit dc8d1eb
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions net/tipc/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -1189,20 +1189,19 @@ int tipc_node_xmit(struct net *net, struct sk_buff_head *list,
spin_unlock_bh(&le->lock);
}
tipc_node_read_unlock(n);
if (likely(!skb_queue_empty(&xmitq))) {
if (likely(!rc))
tipc_bearer_xmit(net, bearer_id, &xmitq, &le->maddr);
return 0;
}
if (unlikely(rc == -ENOBUFS))
else if (rc == -ENOBUFS)
tipc_node_link_down(n, bearer_id, false);
tipc_node_put(n);
return rc;
}

if (unlikely(!in_own_node(net, dnode)))
return rc;
tipc_sk_rcv(net, list);
return 0;
if (likely(in_own_node(net, dnode))) {
tipc_sk_rcv(net, list);
return 0;
}
return rc;
}

/* tipc_node_xmit_skb(): send single buffer to destination
Expand Down

0 comments on commit dc8d1eb

Please sign in to comment.