diff options
| author | Anil Kaushik <anilkaushikwireless@gmail.com> | 2026-11-02 12:09:29 +0000 |
|---|---|---|
| committer | Jakub Kicinski <kuba@kernel.org> | 2026-11-06 12:49:53 -0800 |
| commit | a36b9e205cb3c452ab96cc783e63465d466fe615 (patch) | |
| tree | 9dbef936761708c6770d50808fcda2a813b1fa2b /scripts/const_structs.checkpatch | |
| parent | 29066b0fc046a2965129a74325b98d9abb4647a9 (diff) | |
netlink: Do not call the unbind callback with the table locked
When netlink_bind() fails to insert the socket, it calls
netlink_undo_bind() with the table locked. genl_unbind() then takes
cb_lock, while genl_unregister_family() and genl_register_family() take
cb_lock for writing and then wait in netlink_table_grab() for the table
users to go away:
netlink_bind() genl_unregister_family()
netlink_lock_table() down_write(&cb_lock)
netlink_insert() fails
netlink_undo_bind() netlink_table_grab()
genl_unbind() waits for nl_table_users == 0
down_read(&cb_lock)
An unprivileged user can get here by binding to a port ID that is in
use, with nl_groups set. Lockdep does not see it, as nl_table_users is a
plain counter.
Unlock the table first, as the comment in netlink_release() asks for.
Link: https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261101101347.3910654-1-anilkaushikwireless@gmail.com
Fixes: 3de21a8990d3 ("genetlink: Add per family bind/unbind callbacks")
Signed-off-by: Anil Kaushik <anilkaushikwireless@gmail.com>
Reviewed-by: Simon Horman <horms@kernel.org>
Link: https://patch.msgid.link/20261102120929.4077030-1-anilkaushikwireless@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'scripts/const_structs.checkpatch')
0 files changed, 0 insertions, 0 deletions
