Skip to content

Commit

Permalink
tipc: make media_ptr pointed netdevice valid
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Ying Xue authored and David S. Miller committed Apr 23, 2014
1 parent 7216cd9 commit f1c8d8c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions net/tipc/bearer.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit f1c8d8c

Please sign in to comment.