From: Dimitri Daskalakis fbnic_queue_stop() stops the vector's Tx queues with netif_stop_subqueue(), which only sets the stop bit. This races with senders who are already in fbnic_xmit_frame(). Use the new netif_disable_subqueue() helper prevent freeing rings while senders are still in xmit. This bug was found by AI and verified on HW. Forced by adding a 20ms delay in fbnic_tx_map() on Tx queue 5, binding devmem to rxq 5 under traffic: before: BUG: kernel NULL pointer dereference, address: 000000000000002e RIP: 0010:fbnic_clean_twq0+0xa8/0x290 after: fbnic_queue_stop() waits for the in-flight xmit, no crash (10/10) Fixes: da43127a8edc ("eth: fbnic: support queue ops / zero-copy Rx") Signed-off-by: Dimitri Daskalakis --- drivers/net/ethernet/meta/fbnic/fbnic_txrx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c index c0fe89425430..62b67940c13e 100644 --- a/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c +++ b/drivers/net/ethernet/meta/fbnic/fbnic_txrx.c @@ -3191,7 +3191,7 @@ static int fbnic_queue_stop(struct net_device *dev, void *qmem, int idx) for (i = 0; i < nv->txt_count; i++) { if (nv->qt[i].sub0.flags & FBNIC_RING_F_DISABLED) continue; - netif_stop_subqueue(dev, nv->qt[i].sub0.q_idx); + netif_disable_subqueue(dev, nv->qt[i].sub0.q_idx); } fbnic_nv_disable(fbn, nv); -- 2.52.1