Linux IEEE 802.15.4 and 6LoWPAN development
 help / color / mirror / Atom feed
* Re: [PATCH net] ieee802154: hwsim: free PIB after unregistering hardware
@ 2026-11-07  6:06 Roshan Kumar
  2026-11-17 10:09 ` Miquel Raynal
  0 siblings, 1 reply; 8+ messages in thread
From: Roshan Kumar @ 2026-11-07  6:06 UTC (permalink / raw)
  To: Yousef Alhouseen
  Cc: Alexander Aring, Stefan Schmidt, Miquel Raynal, linux-wpan,
	netdev

Hi Yousef,

I independently reproduced and tested this issue on current wpan.git
(2b4707a149a5). I also prepared the requested rcu_access_pointer()
update. It passes checkpatch, targeted W=1 allmodconfig/allyesconfig
builds, and 200 KASAN teardown rounds without sanitizer findings.

Are you planning to post v2? If not, I can forward it while preserving
your authorship and Signed-off-by, adding my Signed-off-by as the
forwarding submitter.

v1: https://lore.kernel.org/all/20260627235805.17310-1-alhouseenyousef@gmail.com/

Thanks,
Roshan

^ permalink raw reply	[flat|nested] 8+ messages in thread
* [PATCH net] ieee802154: hwsim: free PIB after unregistering hardware
@ 2026-06-27 23:58 Yousef Alhouseen
  2026-07-03 11:15 ` Miquel Raynal
  0 siblings, 1 reply; 8+ messages in thread
From: Yousef Alhouseen @ 2026-06-27 23:58 UTC (permalink / raw)
  To: Alexander Aring, Stefan Schmidt
  Cc: Miquel Raynal, Andrew Lunn, David S . Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, linux-wpan, netdev, linux-kernel,
	stable, syzbot+4707bb8a43a42fca2b97, Yousef Alhouseen

hwsim_del() queues the currently published PIB for RCU freeing before
unregistering the hardware. The unregister path can still invoke driver
callbacks, including set_promiscuous_mode(), after that grace period has
started. A callback can consequently dereference the freed PIB.

Unregister the hardware first, then fetch and free the final PIB. This also
handles a PIB replacement performed by a callback during unregister.

Fixes: 1c9f4a3fce77 ("ieee802154: hwsim: fix rcu handling")
Reported-by: syzbot+4707bb8a43a42fca2b97@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=4707bb8a43a42fca2b97
Cc: stable@vger.kernel.org
Signed-off-by: Yousef Alhouseen <alhouseenyousef@gmail.com>
---
 drivers/net/ieee802154/mac802154_hwsim.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ieee802154/mac802154_hwsim.c b/drivers/net/ieee802154/mac802154_hwsim.c
index 6daa0f198..2a2d8a9eb 100644
--- a/drivers/net/ieee802154/mac802154_hwsim.c
+++ b/drivers/net/ieee802154/mac802154_hwsim.c
@@ -1004,12 +1004,11 @@ static void hwsim_del(struct hwsim_phy *phy)
 		list_del_rcu(&e->list);
 		hwsim_free_edge(e);
 	}
-	pib = rcu_dereference(phy->pib);
 	rcu_read_unlock();
 
-	kfree_rcu(pib, rcu);
-
 	ieee802154_unregister_hw(phy->hw);
+	pib = rcu_dereference_protected(phy->pib, 1);
+	kfree_rcu(pib, rcu);
 	ieee802154_free_hw(phy->hw);
 }
 
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2026-11-17 10:09 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-07  6:06 [PATCH net] ieee802154: hwsim: free PIB after unregistering hardware Roshan Kumar
2026-11-17 10:09 ` Miquel Raynal
  -- strict thread matches above, loose matches on Subject: below --
2026-06-27 23:58 Yousef Alhouseen
2026-07-03 11:15 ` Miquel Raynal
2026-07-03 11:19   ` Yousef Alhouseen
2026-07-06 15:10     ` Miquel Raynal
2026-07-18 12:20       ` Yousef Alhouseen
2026-09-02  8:22         ` Stefan Schmidt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox