aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2011-10-20 00:26:01 -0400
committerDavid S. Miller <davem@davemloft.net>2011-10-21 02:53:06 -0400
commit99f34b38cdc8f75a4b9adb5a617b118253b3efe1 (patch)
tree07197b487004886a51a47c8fb4fe94e9e5bdc6a9 /drivers/net
parent4b727361f0bc7ee7378298941066d8aa15023ffb (diff)
macvtap: Close a race between macvtap_open and macvtap_dellink.
There is a small window in macvtap_open between looking up a networking device and calling macvtap_set_queue in which macvtap_del_queues called from macvtap_dellink. After calling macvtap_del_queues it is totally incorrect to allow macvtap_set_queue to proceed so prevent success by reporting that all of the available queues are in use. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/macvtap.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/net/macvtap.c b/drivers/net/macvtap.c
index 3da557830937..70aa628834f0 100644
--- a/drivers/net/macvtap.c
+++ b/drivers/net/macvtap.c
@@ -231,6 +231,8 @@ static void macvtap_del_queues(struct net_device *dev)
231 } 231 }
232 } 232 }
233 BUG_ON(vlan->numvtaps != 0); 233 BUG_ON(vlan->numvtaps != 0);
234 /* guarantee that any future macvtap_set_queue will fail */
235 vlan->numvtaps = MAX_MACVTAP_QUEUES;
234 spin_unlock(&macvtap_lock); 236 spin_unlock(&macvtap_lock);
235 237
236 synchronize_rcu(); 238 synchronize_rcu();