netdev: fix the locking for netdev notifications
authorJakub Kicinski <kuba@kernel.org>
Wed, 16 Apr 2025 03:04:47 +0000 (20:04 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 18 Apr 2025 01:55:14 +0000 (18:55 -0700)
commit22cbc1ee268b7ec0000848708944daa61c6e4909
treed6c50fc047a853e866aea2b61ef0dfe735633609
parentcfba1d1b61ae3f32e4bc06e9860711a4488d98b7
netdev: fix the locking for netdev notifications

Kuniyuki reports that the assert for netdev lock fires when
there are netdev event listeners (otherwise we skip the netlink
event generation).

Correct the locking when coming from the notifier.

The NETDEV_XDP_FEAT_CHANGE notifier is already fully locked,
it's the documentation that's incorrect.

Fixes: 99e44f39a8f7 ("netdev: depend on netdev->lock for xdp features")
Reported-by: syzkaller <syzkaller@googlegroups.com>
Reported-by: Kuniyuki Iwashima <kuniyu@amazon.com>
Link: https://lore.kernel.org/20250410171019.62128-1-kuniyu@amazon.com
Acked-by: Stanislav Fomichev <sdf@fomichev.me>
Link: https://patch.msgid.link/20250416030447.1077551-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Documentation/networking/netdevices.rst
include/linux/netdevice.h
include/net/netdev_lock.h
net/core/lock_debug.c
net/core/netdev-genl.c