netdevsim: bound the peer TX queue index in nsim_start_peer_tx_queue()
Subsystems (3)
v2 cover netdevsim: bound the peer TX queue index in nsim_start_peer_tx_queue()
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 patch skips the wake-up in that case.
v2: send the patch inline instead of as an attachment (Jakub).
v1: https://lore.kernel.org/netdev/[email protected]/
The patch was written with LLM assistance; we reviewed and tested it. With it, the reproducer from v1 no longer triggers the KASAN report.
Kyuwon Cho (1):
netdevsim: bound the peer TX queue index in nsim_start_peer_tx_queue()
drivers/net/netdevsim/netdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
Signature · 1 line
2.43.0
PATCH v2 1/1 netdevsim: bound the peer TX queue index in nsim_start_peer_tx_queue()
nsim_start_peer_tx_queue() wakes the peer's TX queue with the index of the RX queue being polled, and only compares this device's TX queue count with the peer's RX queue count. When the device is relinked to a peer with fewer TX queues while its RX queues still hold traffic from the old peer, the index is past the peer's TX queue array:
BUG: KASAN: slab-out-of-bounds in nsim_poll (include/linux/netdevice.h:3834 drivers/net/netdevsim/netdev.c:60) Read of size 8 Call Trace: <IRQ> nsim_poll (drivers/net/netdevsim/netdev.c:409) __napi_poll.constprop.0 (net/core/dev.c:7997) net_rx_action (net/core/dev.c:8217)
Skip the wake-up when the index is not a TX queue of the peer.
--- drivers/net/netdevsim/netdev.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/net/netdevsim/netdev.c +2 -1
@@ -53,7 +53,8 @@ static void nsim_start_peer_tx_queue(struct net_device *dev, struct nsim_rq *rq)/* TX device */ peer_dev = peer_ns->netdev; -if (dev->real_num_tx_queues != peer_dev->num_rx_queues) +if (dev->real_num_tx_queues != peer_dev->num_rx_queues || + idx >= peer_dev->real_num_tx_queues) goto out; txq =netdev_get_tx_queue (peer_dev, idx);
Signature · 1 line
2.43.0
[email protected]
AI reviewThis is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
Hi!
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.
Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account.
*IMPORTANT*: If you do repost (for other reasons) - please include the relevant info in the cover letter or commit messages.
Signature · 2 lines
The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.
Quoted 6 lines · On Sat, 21 Nov 2026 19:38:20 +0000, [email protected] wrote:
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:
- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.
It was found by an LLM-guided test generator that we are developing as a research prototype. One of its tests relinked netdevsim peers while packets were in flight, and KASAN reported the out-of-bounds read in a QEMU guest. The v1 report has the details and the reproducer:
https://lore.kernel.org/netdev/[email protected]/
Thanks,
Kyuwon Cho