This is a note to let you know that I've just added the patch titled net: inline rollback_registered() 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.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:30 +0300 Subject: net: inline rollback_registered() 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-6-pchelkin@xxxxxxxxx> From: Fedor Pchelkin <pchelkin@xxxxxxxxx> From: Jakub Kicinski <kuba@xxxxxxxxxx> commit 037e56bd965e1bc72c2fa9684ac25b56839a338e upstream. rollback_registered() is a local helper, it's common for driver code to call unregister_netdevice_queue(dev, NULL) when they want to unregister netdevices under rtnl_lock. Inline rollback_registered() and adjust the only remaining caller. 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 | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) --- a/net/core/dev.c +++ b/net/core/dev.c @@ -9601,15 +9601,6 @@ static void rollback_registered_many(str } } -static void rollback_registered(struct net_device *dev) -{ - LIST_HEAD(single); - - list_add(&dev->unreg_list, &single); - rollback_registered_many(&single); - list_del(&single); -} - static netdev_features_t netdev_sync_upper_features(struct net_device *lower, struct net_device *upper, netdev_features_t features) { @@ -10148,7 +10139,7 @@ int register_netdevice(struct net_device if (ret) { /* Expect explicit free_netdev() on failure */ dev->needs_free_netdev = false; - rollback_registered(dev); + unregister_netdevice_queue(dev, NULL); goto out; } /* @@ -10755,7 +10746,11 @@ void unregister_netdevice_queue(struct n if (head) { list_move_tail(&dev->unreg_list, head); } else { - rollback_registered(dev); + LIST_HEAD(single); + + list_add(&dev->unreg_list, &single); + rollback_registered_many(&single); + list_del(&single); } } EXPORT_SYMBOL(unregister_netdevice_queue); 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