Skip to content
This repository has been archived by the owner on Aug 27, 2022. It is now read-only.

Commit

Permalink
net: vxlan: properly cleanup devs on module unload
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Daniel Borkmann authored and davem330 committed Jan 15, 2014
1 parent acaf4e7 commit 8425783
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions drivers/net/vxlan.c
Original file line number Diff line number Diff line change
Expand Up @@ -2710,13 +2710,13 @@ static __net_init int vxlan_init_net(struct net *net)
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);
struct vxlan_dev *vxlan, *next;
LIST_HEAD(list_kill);

rtnl_lock();
list_for_each_entry(vxlan, &vn->vxlan_list, next)
unregister_netdevice_queue(vxlan->dev, &list);
unregister_netdevice_many(&list);
list_for_each_entry_safe(vxlan, next, &vn->vxlan_list, next)
vxlan_dellink(vxlan->dev, &list_kill);
unregister_netdevice_many(&list_kill);
rtnl_unlock();
}

Expand Down

0 comments on commit 8425783

Please sign in to comment.