linux/drivers/net/ieee802154
David Carlier 979d5b8de8 ieee802154: hwsim: serialize pib updates to fix double-free
hwsim_update_pib() does an unserialized read-swap-free of phy->pib:

	pib_old = rtnl_dereference(phy->pib);
	...
	rcu_assign_pointer(phy->pib, pib);
	kfree_rcu(pib_old, rcu);

It assumes the RTNL is held, but ->set_channel is not always called
under it: the mac802154 scan worker changes channels via
drv_set_channel() without the RTNL. Such an update can race an
RTNL-held one on the same phy; both read the same pib_old and both
kfree_rcu() it, double-freeing the object. With SLUB percpu sheaves
batching kfree_rcu(), this surfaces as a KASAN invalid-free in
rcu_free_sheaf().

struct hwsim_phy has no lock for pib. Add one and make the swap atomic
with rcu_replace_pointer() under it, dropping the misleading
rtnl_dereference().

Reported-by: syzbot+60332fd095f8bb2946ad@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=60332fd095f8bb2946ad
Fixes: f25da51fdc ("ieee802154: hwsim: add replacement for fakelb")
Signed-off-by: David Carlier <devnexen@gmail.com>
Cc: stable@vger.kernel.org
Link: https://lore.kernel.org/20260709221858.158063-1-devnexen@gmail.com
Signed-off-by: Stefan Schmidt <stefan@datenfreihafen.org>
2026-09-02 10:26:47 +02:00
..
adf7242.c net: ieee802154: adf7242: Fix some potential buffer overflow in adf7242_stats_show() 2023-10-22 11:28:43 +01:00
at86rf230.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
at86rf230.h
atusb.c ieee802154: atusb: drop redundant device reference 2026-03-23 17:35:28 -07:00
atusb.h
ca8210.c ieee802154: ca8210: fix pointer truncation in kfifo on 64-bit 2026-06-19 22:33:04 +02:00
cc2520.c ieee802154: cc2520: fix FIFOP work use-after-free 2026-09-02 09:20:31 +02:00
fakelb.c net: Switch back to struct platform_driver::remove() 2024-10-04 16:39:57 -07:00
Kconfig ieee802154: Fix build error 2024-09-09 21:26:17 +02:00
mac802154_hwsim.c ieee802154: hwsim: serialize pib updates to fix double-free 2026-09-02 10:26:47 +02:00
mac802154_hwsim.h
Makefile
mcr20a.c net: ieee802154: mcr20a: Use IRQF_NO_AUTOEN flag in request_irq() 2024-09-27 10:47:53 +02:00
mcr20a.h
mrf24j40.c Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c files) 2026-07-03 07:38:17 +02:00