linux/net/mac802154
Ibrahim Hashimov 234e5e898b mac802154: hold an interface reference across the scan worker
mac802154_scan_worker() captures the scanning sub-interface under RCU
and then keeps dereferencing sdata->dev after rcu_read_unlock() and
outside the rtnl -- in the failure traces, in
mac802154_transmit_beacon_req() (skb->dev = sdata->dev), and in the
end_scan cleanup. Nothing keeps that netdev alive across the worker
iteration.

A concurrent DEL_INTERFACE or PHY removal can unregister the interface
once the worker drops the rtnl between its two drv_set_channel()
sections. unregister_netdevice() frees the netdev asynchronously from
netdev_run_todo() with the rtnl already dropped, so neither holding the
rtnl nor the per-PHY IEEE802154_IS_SCANNING flag prevents a stale worker
iteration from dereferencing the freed netdev -- a KASAN
slab-use-after-free, reachable by racing TRIGGER_SCAN against
DEL_INTERFACE (both CAP_NET_ADMIN).

Pin the netdev with netdev_hold() while the RCU read lock is still held,
and release it at every worker exit.

Fixes: 57588c7117 ("mac802154: Handle passive scanning")
Cc: stable@vger.kernel.org
Signed-off-by: Ibrahim Hashimov <security@auditcode.ai>
Link: https://patch.msgid.link/20260721211228.34578-1-security@auditcode.ai
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-07-23 10:37:46 -07:00
..
cfg.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
cfg.h
driver-ops.h mac802154: set filter at drv_start() 2022-10-12 12:56:58 +02:00
ieee802154_i.h net: mac802154: Remove unused ieee802154_mlme_tx_one 2024-12-30 16:40:38 +01:00
iface.c mac802154: remove interfaces with RCU list deletion 2026-07-03 16:14:23 +02:00
Kconfig
llsec.c mac802154: llsec: reject frames shorter than the authentication tag 2026-07-23 08:12:25 -07:00
llsec.h
mac_cmd.c
main.c mac802154: Switch to use hrtimer_setup() 2025-02-18 10:35:44 +01:00
Makefile mac802154: Handle passive scanning 2023-01-03 19:48:43 +01:00
mib.c
rx.c treewide: Replace kmalloc with kmalloc_obj for non-scalar types 2026-02-21 01:02:28 -08:00
scan.c mac802154: hold an interface reference across the scan worker 2026-07-23 10:37:46 -07:00
trace.c
trace.h ieee802154: Replace strlcpy with strscpy 2023-06-16 22:14:24 +02:00
tx.c net: mac802154: Remove unused ieee802154_mlme_tx_one 2024-12-30 16:40:38 +01:00
util.c net: mac802154: Fixup function parameter name in docs 2022-10-26 09:40:34 +02:00