* [net 1/1] tipc: fix unsafe rcu locking when accessing publication list
@ 2018-10-12 20:46 Jon Maloy
2018-10-16 5:33 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Jon Maloy @ 2018-10-12 20:46 UTC (permalink / raw)
To: davem, netdev
Cc: gordan.mihaljevic, tung.q.nguyen, hoang.h.le, jon.maloy,
canh.d.luu, ying.xue, tipc-discussion
From: Tung Nguyen <tung.q.nguyen@dektech.com.au>
The binding table's 'cluster_scope' list is rcu protected to handle
races between threads changing the list and those traversing the list at
the same moment. We have now found that the function named_distribute()
uses the regular list_for_each() macro to traverse the said list.
Likewise, the function tipc_named_withdraw() is removing items from the
same list using the regular list_del() call. When these two functions
execute in parallel we see occasional crashes.
This commit fixes this by adding the missing _rcu() suffixes.
Signed-off-by: Tung Nguyen <tung.q.nguyen@dektech.com.au>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
---
net/tipc/name_distr.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/net/tipc/name_distr.c b/net/tipc/name_distr.c
index 51b4b96..3cfeb9d 100644
--- a/net/tipc/name_distr.c
+++ b/net/tipc/name_distr.c
@@ -115,7 +115,7 @@ struct sk_buff *tipc_named_withdraw(struct net *net, struct publication *publ)
struct sk_buff *buf;
struct distr_item *item;
- list_del(&publ->binding_node);
+ list_del_rcu(&publ->binding_node);
if (publ->scope == TIPC_NODE_SCOPE)
return NULL;
@@ -147,7 +147,7 @@ static void named_distribute(struct net *net, struct sk_buff_head *list,
ITEM_SIZE) * ITEM_SIZE;
u32 msg_rem = msg_dsz;
- list_for_each_entry(publ, pls, binding_node) {
+ list_for_each_entry_rcu(publ, pls, binding_node) {
/* Prepare next buffer: */
if (!skb) {
skb = named_prepare_buf(net, PUBLICATION, msg_rem,
--
2.1.4
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [net 1/1] tipc: fix unsafe rcu locking when accessing publication list
2018-10-12 20:46 [net 1/1] tipc: fix unsafe rcu locking when accessing publication list Jon Maloy
@ 2018-10-16 5:33 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-10-16 5:33 UTC (permalink / raw)
To: jon.maloy
Cc: netdev, gordan.mihaljevic, tung.q.nguyen, hoang.h.le, canh.d.luu,
ying.xue, tipc-discussion
From: Jon Maloy <jon.maloy@ericsson.com>
Date: Fri, 12 Oct 2018 22:46:55 +0200
> From: Tung Nguyen <tung.q.nguyen@dektech.com.au>
>
> The binding table's 'cluster_scope' list is rcu protected to handle
> races between threads changing the list and those traversing the list at
> the same moment. We have now found that the function named_distribute()
> uses the regular list_for_each() macro to traverse the said list.
> Likewise, the function tipc_named_withdraw() is removing items from the
> same list using the regular list_del() call. When these two functions
> execute in parallel we see occasional crashes.
>
> This commit fixes this by adding the missing _rcu() suffixes.
>
> Signed-off-by: Tung Nguyen <tung.q.nguyen@dektech.com.au>
> Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
Applied and queued up for -stable.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-10-16 13:22 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-10-12 20:46 [net 1/1] tipc: fix unsafe rcu locking when accessing publication list Jon Maloy
2018-10-16 5:33 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).