diff options
| author | Santosh Kalluri <santosh.kalluri129@gmail.com> | 2026-06-17 10:49:18 -0400 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-07-04 13:39:41 +0200 |
| commit | 6cd7067d6e4b0b2033ba2f918ecbd54dc2af3763 (patch) | |
| tree | 3aee4c121c8092fdde84de3b5fe197d065573cb8 | |
| parent | 53700a63768ca43bd6e3d2798738fcc32f44e21b (diff) | |
| download | linux-stable-6cd7067d6e4b0b2033ba2f918ecbd54dc2af3763.tar.gz linux-stable-6cd7067d6e4b0b2033ba2f918ecbd54dc2af3763.zip | |
net: phonet: free phonet_device after RCU grace period
[ 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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
| -rw-r--r-- | net/phonet/pn_dev.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/phonet/pn_dev.c b/net/phonet/pn_dev.c index 2e7d850dc726..3f020c362d6c 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); } } |
