linux/drivers/net/netdevsim
Eric Dumazet 07e98a4d5e netdevsim: update queue NAPI association on queue reset
In netdevsim, receive queues (struct nsim_rq) embed their own struct
napi_struct. When queue reset is performed (e.g. via queue_reset
debugfs), nsim_queue_start() swaps in a newly allocated struct nsim_rq,
and nsim_queue_mem_free() later deletes and frees the old one.

However, nsim_queue_start() failed to update the queue-to-NAPI mapping
via netif_queue_set_napi(). As a result, dev->_rx[idx].napi continued to
point to the old NAPI struct. After the old queue was freed, a subsequent
queue dump via Netlink (NETDEV_CMD_QUEUE_GET) triggered a KASAN
slab-use-after-free read in nla_put_napi_id() when accessing
rxq->napi->napi_id.

Fix this by calling netif_queue_set_napi() in nsim_queue_start() to
associate the new NAPI with the RX queue, and clear the association
with netif_queue_set_napi(..., NULL) in nsim_del_napi() during teardown.

Fixes: 5bc8e8dbef ("netdevsim: add queue management API support")
Reported-by: syzbot+483a6efbc4882c1201ee@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/netdev/6a82c3d4.f7a79266.2f965f.0024.GAE@google.com/T/#u
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Vadim Fedorenko <vadim.fedorenko@linux.dev>
Link: https://patch.msgid.link/20260817082511.2300402-1-edumazet@google.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2026-08-20 12:35:57 -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 netdevsim: drop the ability to change max_vfs via debugfs 2026-08-13 17:38:05 -07:00
dev.c netdevsim: drop the ability to change max_vfs via debugfs 2026-08-13 17:38:05 -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: update queue NAPI association on queue reset 2026-08-20 12:35:57 -07:00
netdevsim.h netdevsim: drop the ability to change max_vfs via debugfs 2026-08-13 17:38:05 -07:00
psample.c net: Use helpers to get/set UDP len tree-wide 2026-07-22 13:47:02 +02:00
psp.c net: Use helpers to get/set UDP len tree-wide 2026-07-22 13:47:02 +02: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