Message ID | 20240917010734.1905-3-antonio@openvpn.net (mailing list archive) |
---|---|
State | Deferred |
Delegated to: | Netdev Maintainers |
Headers | show |
Series | Introducing OpenVPN Data Channel Offload | expand |
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c index f0a520987085..7e7fcd319af8 100644 --- a/net/core/rtnetlink.c +++ b/net/core/rtnetlink.c @@ -453,8 +453,12 @@ static void __rtnl_kill_links(struct net *net, struct rtnl_link_ops *ops) LIST_HEAD(list_kill); for_each_netdev(net, dev) { - if (dev->rtnl_link_ops == ops) - ops->dellink(dev, &list_kill); + if (dev->rtnl_link_ops == ops) { + if (ops->dellink) + ops->dellink(dev, &list_kill); + else + unregister_netdevice_queue(dev, &list_kill); + } } unregister_netdevice_many(&list_kill); }
rtnl_unregister_ops calls __rtnl_links_kill which calls unconditionally ops->dellink on any related interface. However, if a module hasn't implemented dellink, this invocation will crash. Add a check to avoid calling dellink when NULL and rather invoke netdevice_unregister_queue to schedule unregistering the device as usual. Signed-off-by: Antonio Quartulli <antonio@openvpn.net> --- net/core/rtnetlink.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)