Commit 8a275a6a authored by Allan Stephens's avatar Allan Stephens Committed by Paul Gortmaker

tipc: Fix node lock reclamation issues in broadcast link reception

Fixes a pair of problems in broadcast link message reception code
relating to the reclamation of the node lock after consuming an
in-sequence message.

1) Now retests to see if the sending node is still up after reclaiming
   the node lock, and bails out if it is non-operational.

2) Now manipulates the node's deferred message queue only after
   reclaiming the node lock, rather than using queue head pointer
   information that was cached previously.
Signed-off-by: default avatarAllan Stephens <allan.stephens@windriver.com>
Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
parent 57732560
...@@ -474,7 +474,7 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf) ...@@ -474,7 +474,7 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf)
struct tipc_node *node; struct tipc_node *node;
u32 next_in; u32 next_in;
u32 seqno; u32 seqno;
struct sk_buff *deferred; int deferred;
/* Screen out unwanted broadcast messages */ /* Screen out unwanted broadcast messages */
...@@ -489,6 +489,8 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf) ...@@ -489,6 +489,8 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf)
if (unlikely(!node->bclink.supported)) if (unlikely(!node->bclink.supported))
goto unlock; goto unlock;
/* Handle broadcast protocol message */
if (unlikely(msg_user(msg) == BCAST_PROTOCOL)) { if (unlikely(msg_user(msg) == BCAST_PROTOCOL)) {
if (msg_type(msg) != STATE_MSG) if (msg_type(msg) != STATE_MSG)
goto unlock; goto unlock;
...@@ -513,11 +515,11 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf) ...@@ -513,11 +515,11 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf)
/* Handle in-sequence broadcast message */ /* Handle in-sequence broadcast message */
receive:
next_in = mod(node->bclink.last_in + 1);
seqno = msg_seqno(msg); seqno = msg_seqno(msg);
next_in = mod(node->bclink.last_in + 1);
if (likely(seqno == next_in)) { if (likely(seqno == next_in)) {
receive:
bcl->stats.recv_info++; bcl->stats.recv_info++;
node->bclink.last_in++; node->bclink.last_in++;
bclink_set_gap(node); bclink_set_gap(node);
...@@ -551,23 +553,40 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf) ...@@ -551,23 +553,40 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf)
buf_discard(buf); buf_discard(buf);
} }
buf = NULL; buf = NULL;
/* Determine new synchronization state */
tipc_node_lock(node); tipc_node_lock(node);
deferred = node->bclink.deferred_head; if (unlikely(!tipc_node_is_up(node)))
if (deferred && (buf_seqno(deferred) == mod(next_in + 1))) { goto unlock;
buf = deferred;
msg = buf_msg(buf); if (!node->bclink.deferred_head)
node->bclink.deferred_head = deferred->next; goto unlock;
goto receive;
} msg = buf_msg(node->bclink.deferred_head);
} else if (less(next_in, seqno)) { seqno = msg_seqno(msg);
next_in = mod(next_in + 1);
if (seqno != next_in)
goto unlock;
/* Take in-sequence message from deferred queue & deliver it */
buf = node->bclink.deferred_head;
node->bclink.deferred_head = buf->next;
goto receive;
}
/* Handle out-of-sequence broadcast message */
if (less(next_in, seqno)) {
u32 gap_after = node->bclink.gap_after; u32 gap_after = node->bclink.gap_after;
u32 gap_to = node->bclink.gap_to; u32 gap_to = node->bclink.gap_to;
if (tipc_link_defer_pkt(&node->bclink.deferred_head, deferred = tipc_link_defer_pkt(&node->bclink.deferred_head,
&node->bclink.deferred_tail, &node->bclink.deferred_tail,
buf)) { buf);
if (deferred) {
node->bclink.nack_sync++; node->bclink.nack_sync++;
bcl->stats.deferred_recv++;
if (seqno == mod(gap_after + 1)) if (seqno == mod(gap_after + 1))
node->bclink.gap_after = seqno; node->bclink.gap_after = seqno;
else if (less(gap_after, seqno) && less(seqno, gap_to)) else if (less(gap_after, seqno) && less(seqno, gap_to))
...@@ -579,9 +598,12 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf) ...@@ -579,9 +598,12 @@ void tipc_bclink_recv_pkt(struct sk_buff *buf)
bclink_send_nack(node); bclink_send_nack(node);
bclink_set_gap(node); bclink_set_gap(node);
} }
} else { } else
bcl->stats.duplicates++; deferred = 0;
}
if (deferred)
bcl->stats.deferred_recv++;
unlock: unlock:
tipc_node_unlock(node); tipc_node_unlock(node);
exit: exit:
......
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