net: force a list_del() in unregister_netdevice_many()
unregister_netdevice_many() API is error prone and we had too
many bugs because of dangling LIST_HEAD on stacks.
See commit f87e6f4793
("net: dont leave active on stack LIST_HEAD")
In fact, instead of making sure no caller leaves an active list_head,
just force a list_del() in the callee. No one seems to need to access
the list after unregister_netdevice_many()
Signed-off-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
ba6de0f530
commit
87757a917b
@@ -6613,6 +6613,9 @@ EXPORT_SYMBOL(unregister_netdevice_queue);
|
||||
/**
|
||||
* unregister_netdevice_many - unregister many devices
|
||||
* @head: list of devices
|
||||
*
|
||||
* Note: As most callers use a stack allocated list_head,
|
||||
* we force a list_del() to make sure stack wont be corrupted later.
|
||||
*/
|
||||
void unregister_netdevice_many(struct list_head *head)
|
||||
{
|
||||
@@ -6622,6 +6625,7 @@ void unregister_netdevice_many(struct list_head *head)
|
||||
rollback_registered_many(head);
|
||||
list_for_each_entry(dev, head, unreg_list)
|
||||
net_set_todo(dev);
|
||||
list_del(head);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(unregister_netdevice_many);
|
||||
@@ -7077,7 +7081,6 @@ static void __net_exit default_device_exit_batch(struct list_head *net_list)
|
||||
}
|
||||
}
|
||||
unregister_netdevice_many(&dev_kill_list);
|
||||
list_del(&dev_kill_list);
|
||||
rtnl_unlock();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user