summaryrefslogtreecommitdiff
path: root/net/tipc/net.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2017-05-23 21:53:35 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-06-17 06:41:49 +0200
commit44bc7cae603167feb86b7f8f0684df62ffaac7f4 (patch)
treea200e0d359db3291812b8973624a4bc334a4fafa /net/tipc/net.c
parentcb351da6f2badf45d87cf0d21826d81a77f5e433 (diff)
tipc: Fix tipc_sk_reinit race conditions
[ Upstream commit 9dbbfb0ab6680c6a85609041011484e6658e7d3c ] 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> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'net/tipc/net.c')
-rw-r--r--net/tipc/net.c4
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)
char addr_string[16];
tn->own_addr = addr;
+
+ /* Ensure that the new address is visible before we reinit. */
+ smp_mb();
+
tipc_named_reinit(net);
tipc_sk_reinit(net);