Commit 4988bb4a authored by Erik Hugne's avatar Erik Hugne Committed by David S. Miller

tipc: fix missing spinlock init and nullptr oops

commit 908344cd ("tipc: fix bug in multicast congestion
handling") introduced two bugs with the bclink wakeup
function. This commit fixes the missing spinlock init for the
waiting_sks list. We also eliminate the race condition
between the waiting_sks length check/dequeue operations in
tipc_bclink_wakeup_users by simply removing the redundant
length check.
Signed-off-by: default avatarErik Hugne <erik.hugne@ericsson.com>
Acked-by: default avatarTero Aho <Tero.Aho@coriant.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent d9a28c5b
...@@ -233,8 +233,11 @@ static void bclink_retransmit_pkt(u32 after, u32 to) ...@@ -233,8 +233,11 @@ static void bclink_retransmit_pkt(u32 after, u32 to)
*/ */
void tipc_bclink_wakeup_users(void) void tipc_bclink_wakeup_users(void)
{ {
while (skb_queue_len(&bclink->link.waiting_sks)) struct sk_buff *skb;
tipc_sk_rcv(skb_dequeue(&bclink->link.waiting_sks));
while ((skb = skb_dequeue(&bclink->link.waiting_sks)))
tipc_sk_rcv(skb);
} }
/** /**
...@@ -950,7 +953,7 @@ int tipc_bclink_init(void) ...@@ -950,7 +953,7 @@ int tipc_bclink_init(void)
spin_lock_init(&bclink->lock); spin_lock_init(&bclink->lock);
__skb_queue_head_init(&bcl->outqueue); __skb_queue_head_init(&bcl->outqueue);
__skb_queue_head_init(&bcl->deferred_queue); __skb_queue_head_init(&bcl->deferred_queue);
__skb_queue_head_init(&bcl->waiting_sks); skb_queue_head_init(&bcl->waiting_sks);
bcl->next_out_no = 1; bcl->next_out_no = 1;
spin_lock_init(&bclink->node.lock); spin_lock_init(&bclink->node.lock);
__skb_queue_head_init(&bclink->node.waiting_sks); __skb_queue_head_init(&bclink->node.waiting_sks);
......
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