Skip to content

Commit

Permalink
tipc: fix broadcast wakeup contention after congestion
Browse files Browse the repository at this point in the history
commit 908344c ("tipc: fix bug in multicast congestion handling")
introduced a race in the broadcast link wakeup functionality.

This patch eliminates this broadcast link wakeup race caused by
operation on the wakeup list without proper locking. If this race
hit and corrupted the list all subsequent wakeup messages would be
lost, resulting in a considerable memory leak.

Signed-off-by: Richard Alpe <richard.alpe@ericsson.com>
Signed-off-by: Erik Hugne <erik.hugne@ericsson.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Richard Alpe authored and David S. Miller committed Dec 10, 2014
1 parent 4f675eb commit 340b6e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions net/tipc/link.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ struct tipc_link *tipc_link_create(struct tipc_node *n_ptr,
l_ptr->next_out_no = 1;
__skb_queue_head_init(&l_ptr->outqueue);
__skb_queue_head_init(&l_ptr->deferred_queue);
__skb_queue_head_init(&l_ptr->waiting_sks);
skb_queue_head_init(&l_ptr->waiting_sks);

link_reset_statistics(l_ptr);

Expand Down Expand Up @@ -358,7 +358,7 @@ static bool link_schedule_user(struct tipc_link *link, u32 oport,
return false;
TIPC_SKB_CB(buf)->chain_sz = chain_sz;
TIPC_SKB_CB(buf)->chain_imp = imp;
__skb_queue_tail(&link->waiting_sks, buf);
skb_queue_tail(&link->waiting_sks, buf);
link->stats.link_congs++;
return true;
}
Expand All @@ -378,8 +378,8 @@ static void link_prepare_wakeup(struct tipc_link *link)
if (pend_qsz >= link->queue_limit[TIPC_SKB_CB(skb)->chain_imp])
break;
pend_qsz += TIPC_SKB_CB(skb)->chain_sz;
__skb_unlink(skb, &link->waiting_sks);
__skb_queue_tail(&link->owner->waiting_sks, skb);
skb_unlink(skb, &link->waiting_sks);
skb_queue_tail(&link->owner->waiting_sks, skb);
}
}

Expand Down
2 changes: 1 addition & 1 deletion net/tipc/node.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ struct tipc_node *tipc_node_create(u32 addr)
INIT_LIST_HEAD(&n_ptr->list);
INIT_LIST_HEAD(&n_ptr->publ_list);
INIT_LIST_HEAD(&n_ptr->conn_sks);
__skb_queue_head_init(&n_ptr->waiting_sks);
skb_queue_head_init(&n_ptr->waiting_sks);
__skb_queue_head_init(&n_ptr->bclink.deferred_queue);

hlist_add_head_rcu(&n_ptr->hash, &node_htable[tipc_hashfn(addr)]);
Expand Down

0 comments on commit 340b6e5

Please sign in to comment.