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/1795…@gmail.com/ send the patch inline instead of as an attachment (Jakub). v1: https://lore.kernel.org/netdev/1795…@gmail.com/ 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