summaryrefslogtreecommitdiffstats
path: root/net/tipc/bearer.c
diff options
context:
space:
mode:
authorYing Xue <ying.xue@windriver.com>2014-04-21 04:55:49 +0200
committerDavid S. Miller <davem@davemloft.net>2014-04-23 03:17:53 +0200
commitf1c8d8cb82113ea6f41d2774127d3d08a4ca8d46 (patch)
tree2d693909807175458e181073041ec2d63cdb3fa0 /net/tipc/bearer.c
parenttipc: purge tipc_net_lock lock (diff)
downloadlinux-f1c8d8cb82113ea6f41d2774127d3d08a4ca8d46.tar.xz
linux-f1c8d8cb82113ea6f41d2774127d3d08a4ca8d46.zip
tipc: make media_ptr pointed netdevice valid
The 'media_ptr' pointer in bearer structure which points to network device, is protected by RCU. So, before netdevice is released, synchronize_net() should be involved to prevent no any user of the netdevice on read side from accessing it after it is freed. Signed-off-by: Ying Xue <ying.xue@windriver.com> Reviewed-by: Jon Maloy <jon.maloy@ericsson.com> Reviewed-by: Erik Hugne <erik.hugne@ericsson.com> Tested-by: Erik Hugne <erik.hugne@ericsson.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc/bearer.c')
-rw-r--r--net/tipc/bearer.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/tipc/bearer.c b/net/tipc/bearer.c
index 1bd96eb465e1..402e99472a63 100644
--- a/net/tipc/bearer.c
+++ b/net/tipc/bearer.c
@@ -471,6 +471,7 @@ void tipc_disable_l2_media(struct tipc_bearer *b)
dev = (struct net_device *)rtnl_dereference(b->media_ptr);
RCU_INIT_POINTER(b->media_ptr, NULL);
RCU_INIT_POINTER(dev->tipc_ptr, NULL);
+ synchronize_net();
dev_put(dev);
}