Thread View: linux.kernel.netdev
2 messages
2 total messages
Started by Kyuwon Cho
Sat, 21 Nov 2026 19:32
[PATCH net v2 1/1] netdevsim: bound the peer TX queue index in nsim_start_peer_tx_queue()
Author: Kyuwon Cho
Date: Sat, 21 Nov 2026 19:32
Date: Sat, 21 Nov 2026 19:32
39 lines
12434 bytes
12434 bytes
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.
Fixes: ff2ac4df58ad ("netdevsim: implement peer queue flow control")
Signed-off-by: Kyuwon Cho <kyuwoncho18@gmail.com>
---
drivers/net/netdevsim/netdev.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index eebc02ccc4a9..6e287ae692a8 100644
--- a/drivers/net/netdevsim/netdev.c
+++ b/drivers/net/netdevsim/netdev.c
@@ -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);
--
2.43.0
Re: [PATCH net v2 1/1] netdevsim: bound the peer TX queue index in nsim_start_peer_tx_queue()
Author: Jiayuan Chen
Date: Fri, 27 Nov 2026 09:20
Date: Fri, 27 Nov 2026 09:20
24 lines
9317 bytes
9317 bytes
On 11/22/26 3:32 AM, Kyuwon Cho wrote:
> 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.
>
> Fixes: ff2ac4df58ad ("netdevsim: implement peer queue flow control")
> Signed-off-by: Kyuwon Cho <kyuwoncho18@gmail.com>
Reviewed-by: Jiayuan Chen <jiayuan.chen@linux.dev>
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads