From: Simon Horman <horms@kernel.org>
To: Anil Kaushik <anilkaushikwireless@gmail.com>
Cc: netdev@vger.kernel.org, "David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Nicolas Dichtel <nicolas.dichtel@6wind.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH net] netlink: Do not call the unbind callback with the table locked
Date: Fri, 6 Nov 2026 08:30:29 +0000 [thread overview]
Message-ID: <20261106083029.GB865646@horms.kernel.org> (raw)
In-Reply-To: <20261102120929.4077030-1-anilkaushikwireless@gmail.com>
On Mon, Nov 02, 2026 at 12:09:29PM +0000, Anil Kaushik wrote:
> 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>
next prev parent reply other threads:[~2026-11-06 8:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-02 12:09 Anil Kaushik
2026-11-02 12:13 ` netdev-bot+sinfo
2026-11-02 12:53 ` Anil Kaushik
2026-11-02 14:35 ` Anil Kaushik
2026-11-06 8:30 ` Simon Horman [this message]
2026-11-06 21:00 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261106083029.GB865646@horms.kernel.org \
--to=horms@kernel.org \
--cc=anilkaushikwireless@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=nicolas.dichtel@6wind.com \
--cc=pabeni@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®