From: Paolo Abeni <pabeni@redhat.com>
To: Junjie Cao <junjie.cao@intel.com>,
davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
syzbot+14afda08dc3484d5db82@syzkaller.appspotmail.com
Cc: horms@kernel.org, linux-hams@vger.kernel.org,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
syzkaller-bugs@googlegroups.com, stable@vger.kernel.org
Subject: Re: [PATCH] netrom: fix possible deadlock between nr_rt_ioctl() and nr_rt_device_down()
Date: Tue, 2 Dec 2025 12:02:02 +0100 [thread overview]
Message-ID: <29f61bac-ec6a-447d-a2f4-89328eaba688@redhat.com> (raw)
In-Reply-To: <20251127084112.123837-1-junjie.cao@intel.com>
On 11/27/25 9:41 AM, Junjie Cao wrote:
> syzbot reported a circular locking dependency involving
> nr_neigh_list_lock, nr_node_list_lock and nr_node->node_lock in the
> NET/ROM routing code [1].
>
> One of the problematic scenarios looks like this:
>
> CPU0 CPU1
> ---- ----
> nr_rt_device_down() nr_rt_ioctl()
> lock(nr_neigh_list_lock); nr_del_node()
> ... lock(nr_node_list_lock);
> lock(nr_node_list_lock); nr_remove_neigh();
> lock(nr_neigh_list_lock);
>
> This creates the following lock chain:
>
> nr_neigh_list_lock -> nr_node_list_lock -> &nr_node->node_lock
>
> while the ioctl path may acquire the locks in the opposite order via
> nr_dec_obs()/nr_del_node(), which makes lockdep complain about a
> possible deadlock.
>
> Refactor nr_rt_device_down() to avoid nested locking of
> nr_neigh_list_lock and nr_node_list_lock. The function now performs
> two separate passes: one that walks all nodes under nr_node_list_lock
> and drops routes / reference counts, and a second one that removes
> unused neighbours under nr_neigh_list_lock.
>
> This also fixes a reference count leak of nr_neigh in the node route
> removal path.
Please don't mix separate fixes; the latter need to go in a different
patch to help reviewers. Also both of them need a suitable Fixes tag.
Thanks,
Paolo
prev parent reply other threads:[~2025-12-02 11:02 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-11-27 8:41 [PATCH] netrom: fix possible deadlock between nr_rt_ioctl() and nr_rt_device_down() Junjie Cao
2025-12-02 11:02 ` Paolo Abeni [this message]
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=29f61bac-ec6a-447d-a2f4-89328eaba688@redhat.com \
--to=pabeni@redhat.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=junjie.cao@intel.com \
--cc=kuba@kernel.org \
--cc=linux-hams@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=syzbot+14afda08dc3484d5db82@syzkaller.appspotmail.com \
--cc=syzkaller-bugs@googlegroups.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