This is a note to let you know that I've just added the patch titled net: inline rollback_registered_many() to the 5.10-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: net-inline-rollback_registered_many.patch and it can be found in the queue-5.10 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From foo@baz Sat Jul 23 05:03:39 PM CEST 2022 From: Fedor Pchelkin <pchelkin@xxxxxxxxx> Date: Fri, 15 Jul 2022 19:26:32 +0300 Subject: net: inline rollback_registered_many() To: stable@xxxxxxxxxxxxxxx, Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> Cc: Fedor Pchelkin <pchelkin@xxxxxxxxx>, Jakub Kicinski <kuba@xxxxxxxxxx>, Alexey Khoroshilov <khoroshilov@xxxxxxxxx>, Edwin Peer <edwin.peer@xxxxxxxxxxxx> Message-ID: <20220715162632.332718-8-pchelkin@xxxxxxxxx> From: Fedor Pchelkin <pchelkin@xxxxxxxxx> From: Jakub Kicinski <kuba@xxxxxxxxxx> commit 0cbe1e57a7b93517100b0eb63d8e445cfbeb630c upstream. Similar to the change for rollback_registered() - rollback_registered_many() was a part of unregister_netdevice_many() minus the net_set_todo(), which is no longer needed. Functionally this patch moves the list_empty() check back after: BUG_ON(dev_boot_phase); ASSERT_RTNL(); but I can't find any reason why that would be an issue. Reviewed-by: Edwin Peer <edwin.peer@xxxxxxxxxxxx> Signed-off-by: Jakub Kicinski <kuba@xxxxxxxxxx> Signed-off-by: Fedor Pchelkin <pchelkin@xxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- net/core/dev.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) --- a/net/core/dev.c +++ b/net/core/dev.c @@ -5750,7 +5750,7 @@ static void flush_all_backlogs(void) } /* we can have in flight packet[s] on the cpus we are not flushing, - * synchronize_net() in rollback_registered_many() will take care of + * synchronize_net() in unregister_netdevice_many() will take care of * them */ for_each_cpu(cpu, &flush_cpus) @@ -10633,8 +10633,6 @@ void synchronize_net(void) } EXPORT_SYMBOL(synchronize_net); -static void rollback_registered_many(struct list_head *head); - /** * unregister_netdevice_queue - remove device from the kernel * @dev: device @@ -10658,8 +10656,7 @@ void unregister_netdevice_queue(struct n LIST_HEAD(single); list_add(&dev->unreg_list, &single); - rollback_registered_many(&single); - list_del(&single); + unregister_netdevice_many(&single); } } EXPORT_SYMBOL(unregister_netdevice_queue); @@ -10673,21 +10670,15 @@ EXPORT_SYMBOL(unregister_netdevice_queue */ void unregister_netdevice_many(struct list_head *head) { - if (!list_empty(head)) { - rollback_registered_many(head); - list_del(head); - } -} -EXPORT_SYMBOL(unregister_netdevice_many); - -static void rollback_registered_many(struct list_head *head) -{ struct net_device *dev, *tmp; LIST_HEAD(close_head); BUG_ON(dev_boot_phase); ASSERT_RTNL(); + if (list_empty(head)) + return; + list_for_each_entry_safe(dev, tmp, head, unreg_list) { /* Some devices call without registering * for initialization unwind. Remove those @@ -10771,7 +10762,10 @@ static void rollback_registered_many(str dev_put(dev); net_set_todo(dev); } + + list_del(head); } +EXPORT_SYMBOL(unregister_netdevice_many); /** * unregister_netdev - remove device from the kernel Patches currently in stable-queue which might be from pchelkin@xxxxxxxxx are queue-5.10/net-make-sure-devices-go-through-netdev_wait_all_refs.patch queue-5.10/net-make-free_netdev-more-lenient-with-unregistering-devices.patch queue-5.10/docs-net-explain-struct-net_device-lifetime.patch queue-5.10/net-move-rollback_registered_many.patch queue-5.10/net-inline-rollback_registered_many.patch queue-5.10/net-move-net_set_todo-inside-rollback_registered.patch queue-5.10/net-inline-rollback_registered.patch