vxlan: unregister on namespace exit
authorstephen hemminger <stephen@networkplumber.org>
Thu, 18 Jul 2013 15:38:26 +0000 (08:38 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sat, 20 Jul 2013 00:07:25 +0000 (17:07 -0700)
Fix memory leaks and other badness from VXLAN network namespace
teardown. When network namespace is removed, all the vxlan devices should
be unregistered (not closed).

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Pravin B Shelar <pshelar@nicira.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/vxlan.c

index a5ba8dd7e6bea33d060e9d5306b9eab6bb2095da..f101034a297af09c94184982b59eb1eae8e12926 100644 (file)
@@ -1878,10 +1878,12 @@ static __net_exit void vxlan_exit_net(struct net *net)
 {
        struct vxlan_net *vn = net_generic(net, vxlan_net_id);
        struct vxlan_dev *vxlan;
+       LIST_HEAD(list);
 
        rtnl_lock();
        list_for_each_entry(vxlan, &vn->vxlan_list, next)
-               dev_close(vxlan->dev);
+               unregister_netdevice_queue(vxlan->dev, &list);
+       unregister_netdevice_many(&list);
        rtnl_unlock();
 }