diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2017-02-11 06:26:46 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-02-17 12:28:35 -0500 |
commit | 40f9f439706073b4b0a654b3b99e18296b7990b3 (patch) | |
tree | baa437731befae16bef34595d72e2b64c2e4a97b /net/tipc/net.c | |
parent | 98687f426bb3e93b9dbbfb614ba331192beae482 (diff) |
tipc: Fix tipc_sk_reinit race conditions
There are two problems with the function tipc_sk_reinit. Firstly
it's doing a manual walk over an rhashtable. This is broken as
an rhashtable can be resized and if you manually walk over it
during a resize then you may miss entries.
Secondly it's missing memory barriers as previously the code used
spinlocks which provide the barriers implicitly.
This patch fixes both problems.
Fixes: 07f6c4bc048a ("tipc: convert tipc reference table to...")
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Acked-by: Ying Xue <ying.xue@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/net.c')
-rw-r--r-- | net/tipc/net.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/net/tipc/net.c b/net/tipc/net.c index 28bf4feeb81c..ab8a2d5d1e32 100644 --- a/net/tipc/net.c +++ b/net/tipc/net.c | |||
@@ -110,6 +110,10 @@ int tipc_net_start(struct net *net, u32 addr) | |||
110 | char addr_string[16]; | 110 | char addr_string[16]; |
111 | 111 | ||
112 | tn->own_addr = addr; | 112 | tn->own_addr = addr; |
113 | |||
114 | /* Ensure that the new address is visible before we reinit. */ | ||
115 | smp_mb(); | ||
116 | |||
113 | tipc_named_reinit(net); | 117 | tipc_named_reinit(net); |
114 | tipc_sk_reinit(net); | 118 | tipc_sk_reinit(net); |
115 | 119 | ||