aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/vxlan.c
diff options
context:
space:
mode:
authorDaniel Borkmann <dborkman@redhat.com>2014-01-13 12:41:20 -0500
committerDavid S. Miller <davem@davemloft.net>2014-01-15 02:38:39 -0500
commit8425783c0f4292ca5be35097a467e1240735c257 (patch)
tree601cab1761c36f24798e4b168595534f5feacb5d /drivers/net/vxlan.c
parentacaf4e70997ff5ef3588f5a8abb1c228de637bd2 (diff)
net: vxlan: properly cleanup devs on module unload
We should use vxlan_dellink() handler in vxlan_exit_net(), since i) we're not in fast-path and we should be consistent in dismantle just as we would remove a device through rtnl ops, and more importantly, ii) in case future code will kfree() memory in vxlan_dellink(), we would leak it right here unnoticed. Therefore, do not only half of the cleanup work, but make it properly. Signed-off-by: Daniel Borkmann <dborkman@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/vxlan.c')
-rw-r--r--drivers/net/vxlan.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index d35d52f03185..a2dee80e1fb8 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2710,13 +2710,13 @@ static __net_init int vxlan_init_net(struct net *net)
2710static __net_exit void vxlan_exit_net(struct net *net) 2710static __net_exit void vxlan_exit_net(struct net *net)
2711{ 2711{
2712 struct vxlan_net *vn = net_generic(net, vxlan_net_id); 2712 struct vxlan_net *vn = net_generic(net, vxlan_net_id);
2713 struct vxlan_dev *vxlan; 2713 struct vxlan_dev *vxlan, *next;
2714 LIST_HEAD(list); 2714 LIST_HEAD(list_kill);
2715 2715
2716 rtnl_lock(); 2716 rtnl_lock();
2717 list_for_each_entry(vxlan, &vn->vxlan_list, next) 2717 list_for_each_entry_safe(vxlan, next, &vn->vxlan_list, next)
2718 unregister_netdevice_queue(vxlan->dev, &list); 2718 vxlan_dellink(vxlan->dev, &list_kill);
2719 unregister_netdevice_many(&list); 2719 unregister_netdevice_many(&list_kill);
2720 rtnl_unlock(); 2720 rtnl_unlock();
2721} 2721}
2722 2722