From: Junjie Cao <junjie.cao@intel.com>
To: pabeni@redhat.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,
junjie.cao@intel.com
Subject: [PATCH 2/2] netrom: fix reference count leak in nr_rt_device_down
Date: Thu, 4 Dec 2025 17:09:05 +0800 [thread overview]
Message-ID: <20251204090905.28663-3-junjie.cao@intel.com> (raw)
In-Reply-To: <20251204090905.28663-1-junjie.cao@intel.com>
When a device goes down, nr_rt_device_down() clears the routes that
use this device. However, it fails to drop the per-route reference to
the neighbour (nr_neigh): neither nr_neigh->count nor its refcount
is decremented when the route is removed.
Mirror the behaviour of nr_dec_obs() / nr_del_node() by decrementing
nr_neigh->count and calling nr_neigh_put(), so that the neighbour
reference is properly released when a device goes down.
Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
Cc: stable@vger.kernel.org
Signed-off-by: Junjie Cao <junjie.cao@intel.com>
---
net/netrom/nr_route.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/netrom/nr_route.c b/net/netrom/nr_route.c
index 20aacfdfccd4..35d10985fd7a 100644
--- a/net/netrom/nr_route.c
+++ b/net/netrom/nr_route.c
@@ -517,6 +517,9 @@ void nr_rt_device_down(struct net_device *dev)
for (i = 0; i < t->count; i++) {
s = t->routes[i].neighbour;
if (s->dev == dev) {
+ s->count--;
+ nr_neigh_put(s);
+
t->count--;
switch (i) {
--
2.43.0
prev parent reply other threads:[~2025-12-04 9:09 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-04 9:09 [PATCH v2 0/2] netrom: fix deadlock and refcount leak in nr_rt_device_down Junjie Cao
2025-12-04 9:09 ` [PATCH 1/2] netrom: fix possible deadlock " Junjie Cao
2026-01-02 20:46 ` Jakub Kicinski
2025-12-04 9:09 ` Junjie Cao [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=20251204090905.28663-3-junjie.cao@intel.com \
--to=junjie.cao@intel.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=linux-hams@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--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;
as well as URLs for NNTP newsgroup(s).