linux/drivers/net/netdevsim
Yousef Alhouseen 2e996ca81f netdevsim: remove ethtool debugfs files before freeing netdev
The ethtool debugfs files point directly into struct netdevsim, which is
allocated as net_device private data. Their containing port directory is
removed only after nsim_destroy() calls free_netdev().

An open simple-attribute file can consequently dereference the freed
private data before the directory is removed. KASAN observed this in
debugfs_u32_get() during network namespace teardown.

Track and remove the ethtool subtree before free_netdev() on both the
normal and registration-failure paths. debugfs removal drains active
file users before returning.

Fixes: ff1f7c17fb ("netdevsim: add pause frame stats")
Reported-by: syzbot+6c25f4750230faf70be9@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=6c25f4750230faf70be9
Cc: <stable+noautosel@kernel.org> # netdevsim is a test harness, it's never loaded on production systems
Signed-off-by: Yousef Alhouseen <alhouseenyousef@gmail.com>
Link: https://patch.msgid.link/20260628002804.24214-1-alhouseenyousef@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-06-29 18:47:23 -07:00
..
bpf.c netdevsim: tc: allow to test nf_tables offload control plane code 2026-06-13 10:29:39 -07:00
bus.c net: netdevsim: correct typo in new_device_store error message 2026-03-20 20:12:01 -07:00
dev.c devlink: pass param values by pointer 2026-05-25 14:03:06 -07:00
ethtool.c netdevsim: remove ethtool debugfs files before freeing netdev 2026-06-29 18:47:23 -07:00
fib.c netdevsim: fib: fix use-after-free of FIB data via debugfs 2026-06-02 12:54:58 -07:00
health.c devlink: Move graceful period parameter to reporter ops 2025-08-26 17:24:16 -07:00
hwstats.c Convert 'alloc_obj' family to use the new default GFP_KERNEL argument 2026-02-21 17:09:51 -08:00
ipsec.c netdevsim: add ipsec hw_features 2025-10-16 15:44:32 -07:00
macsec.c netdevsim: macsec: pad u64 to correct length in logs 2024-10-23 09:51:06 +02:00
Makefile netdevsim: move TC offload code to a dedicated file 2026-03-20 20:13:14 -07:00
netdev.c netdevsim: remove ethtool debugfs files before freeing netdev 2026-06-29 18:47:23 -07:00
netdevsim.h netdevsim: remove ethtool debugfs files before freeing netdev 2026-06-29 18:47:23 -07:00
psample.c net: use get_random_u{16,32,64}() where appropriate 2026-04-09 19:27:43 -07:00
psp.c netdevsim: psp: use atomic64 for psp stats counters 2026-06-02 12:57:46 -07:00
tc.c netdevsim: tc: allow to test nf_tables offload control plane code 2026-06-13 10:29:39 -07:00
udp_tunnels.c netdevsim: remove udp_ports_sleep 2025-06-18 18:53:51 -07:00