aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/vxlan.c
diff options
context:
space:
mode:
authorstephen hemminger <stephen@networkplumber.org>2013-07-13 13:18:18 -0400
committerDavid S. Miller <davem@davemloft.net>2013-07-17 15:51:19 -0400
commitfe5c3561e6f0ac7c9546209f01351113c1b77ec8 (patch)
tree0482e0c7d8cb06a053f4b16b3ba5bc301d89536f /drivers/net/vxlan.c
parentf45708209dc445bac0844f6ce86e315a2ffe8a29 (diff)
vxlan: add necessary locking on device removal
The socket management is now done in workqueue (outside of RTNL) and protected by vn->sock_lock. There were two possible bugs, first the vxlan device was removed from the VNI hash table per socket without holding lock. And there was a race when device is created and the workqueue could run after deletion. Signed-off-by: Stephen Hemminger <stephen@networkplumber.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vxlan.c')
-rw-r--r--drivers/net/vxlan.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 0ba1e7edbb1b..a5ba8dd7e6be 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -1767,9 +1767,15 @@ static int vxlan_newlink(struct net *net, struct net_device *dev,
1767 1767
1768static void vxlan_dellink(struct net_device *dev, struct list_head *head) 1768static void vxlan_dellink(struct net_device *dev, struct list_head *head)
1769{ 1769{
1770 struct vxlan_net *vn = net_generic(dev_net(dev), vxlan_net_id);
1770 struct vxlan_dev *vxlan = netdev_priv(dev); 1771 struct vxlan_dev *vxlan = netdev_priv(dev);
1771 1772
1773 flush_workqueue(vxlan_wq);
1774
1775 spin_lock(&vn->sock_lock);
1772 hlist_del_rcu(&vxlan->hlist); 1776 hlist_del_rcu(&vxlan->hlist);
1777 spin_unlock(&vn->sock_lock);
1778
1773 list_del(&vxlan->next); 1779 list_del(&vxlan->next);
1774 unregister_netdevice_queue(dev, head); 1780 unregister_netdevice_queue(dev, head);
1775} 1781}