From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: "Santosh Kalluri" <santosh.kalluri129@gmail.com>,
"Rémi Denis-Courmont" <remi@remlab.net>,
"Simon Horman" <horms@kernel.org>,
"Jakub Kicinski" <kuba@kernel.org>,
"Sasha Levin" <sashal@kernel.org>
Subject: [PATCH 6.6.y 3/3] net: phonet: free phonet_device after RCU grace period
Date: Wed, 17 Jun 2026 10:33:35 -0400 [thread overview]
Message-ID: <20260617143335.3942705-3-sashal@kernel.org> (raw)
In-Reply-To: <20260617143335.3942705-1-sashal@kernel.org>
From: Santosh Kalluri <santosh.kalluri129@gmail.com>
[ Upstream commit 71de0177b28da751f407581a4515cf4d762f6296 ]
phonet_device_destroy() removes a phonet_device from the per-net device
list with list_del_rcu(), but frees it immediately. RCU readers walking
the same list can still hold a pointer to the object after it has been
removed, leading to a slab-use-after-free.
Use kfree_rcu(), matching the lifetime rule already used by
phonet_address_del() for the same object type.
Fixes: eeb74a9d45f7 ("Phonet: convert devices list to RCU")
Cc: stable@vger.kernel.org
Signed-off-by: Santosh Kalluri <santosh.kalluri129@gmail.com>
Acked-by: Rémi Denis-Courmont <remi@remlab.net>
Reviewed-by: Simon Horman <horms@kernel.org>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
net/phonet/pn_dev.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c
index 2e7d850dc72668..3f020c362d6cde 100644
--- a/net/phonet/pn_dev.c
+++ b/net/phonet/pn_dev.c
@@ -105,7 +105,7 @@ static void phonet_device_destroy(struct net_device *dev)
for_each_set_bit(addr, pnd->addrs, 64)
phonet_address_notify(net, RTM_DELADDR, ifindex, addr);
- kfree(pnd);
+ kfree_rcu(pnd, rcu);
}
}
--
2.53.0
prev parent reply other threads:[~2026-06-17 14:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-15 14:50 FAILED: patch "[PATCH] net: phonet: free phonet_device after RCU grace period" failed to apply to 6.6-stable tree gregkh
2026-06-17 14:33 ` [PATCH 6.6.y 1/3] phonet: Pass ifindex to fill_addr() Sasha Levin
2026-06-17 14:33 ` [PATCH 6.6.y 2/3] phonet: Pass net and ifindex to phonet_address_notify() Sasha Levin
2026-06-17 14:33 ` Sasha Levin [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=20260617143335.3942705-3-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=remi@remlab.net \
--cc=santosh.kalluri129@gmail.com \
--cc=stable@vger.kernel.org \
/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