[PATCH net v3 0/1] netdevsim: fix the inverted queue count check in flow control

From: Kyuwon Cho

Date: Mon Nov 30 2026 - 00:57:11 EST


nsim_start_peer_tx_queue() can wake a TX queue past the end of the
peer's TX queue array after the device is relinked to a peer with fewer
TX queues; KASAN reports a slab-out-of-bounds read in nsim_poll(). The
cause is that the queue count checks in nsim_start_peer_tx_queue() and
nsim_stop_tx_queue() compare the RX device's TX queues with the TX
device's RX queues. The patch compares the right pair, which also keeps
the woken queue inside the peer's TX queue array.

v3: fix the comparison in both functions instead of bounding the index
(Willem). Jiayuan's Reviewed-by is dropped because the fix changed.
v2: https://lore.kernel.org/netdev/179528809256.2009509.5007624677973207521@xxxxxxxxx/
send the patch inline instead of as an attachment (Jakub).
v1: https://lore.kernel.org/netdev/179505710275.3511681.13434978152402269948@xxxxxxxxx/

The issue was found by an LLM-guided test generator that we are
developing as a research prototype. With the patch, the reproducer from
v1 no longer triggers the KASAN report. Tested on net e2fb9368a416.

Kyuwon Cho (1):
netdevsim: fix the inverted queue count check in flow control

drivers/net/netdevsim/netdev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

--
2.43.0