netvsc: use RCU to protect inner device structure
The netvsc driver has an internal structure (netvsc_device) which is created when device is opened and released when device is closed. And also opened/released when MTU or number of channels change. Since this is referenced in the receive and transmit path, it is safer to use RCU to protect/prevent use after free problems. Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
3071ada491
commit
545a8e79bd
@@ -686,7 +686,7 @@ struct net_device_context {
|
||||
/* point back to our device context */
|
||||
struct hv_device *device_ctx;
|
||||
/* netvsc_device */
|
||||
struct netvsc_device *nvdev;
|
||||
struct netvsc_device __rcu *nvdev;
|
||||
/* reconfigure work */
|
||||
struct delayed_work dwork;
|
||||
/* last reconfig time */
|
||||
@@ -780,6 +780,8 @@ struct netvsc_device {
|
||||
atomic_t open_cnt;
|
||||
|
||||
struct netvsc_channel chan_table[VRSS_CHANNEL_MAX];
|
||||
|
||||
struct rcu_head rcu;
|
||||
};
|
||||
|
||||
static inline struct netvsc_device *
|
||||
|
Reference in New Issue
Block a user