public inbox for virtualization@lists.linux-foundation.org
 help / color / mirror / Atom feed
* [PATCH net] virtio-net: correct DMA unmap vq mismatch in virtnet_xsk_pool_enable()
@ 2026-03-20  1:35 Xuan Zhuo
  2026-03-20  9:45 ` Michael S. Tsirkin
  0 siblings, 1 reply; 2+ messages in thread
From: Xuan Zhuo @ 2026-03-20  1:35 UTC (permalink / raw)
  To: netdev
  Cc: Michael S. Tsirkin, Jason Wang, Xuan Zhuo, Eugenio Pérez,
	Andrew Lunn, David S. Miller, Eric Dumazet, Jakub Kicinski,
	Paolo Abeni, virtualization

When enabling the XSK pool, the header DMA address is mapped against
the send queue's virtqueue (sq->vq). However, the error handling path
incorrectly attempts to unmap it against the receive queue's virtqueue
(rq->vq).

Ensure the unmap operation uses the same virtqueue used for mapping to
maintain DMA API consistency.

Fixes: 21a4e3ce6dc7 ("virtio_net: xsk: bind/unbind xsk for tx")
Signed-off-by: Xuan Zhuo <xuanzhuo@linux.alibaba.com>
---
 drivers/net/virtio_net.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c
index 72d6a9c6a5a2..7c6f304b7be5 100644
--- a/drivers/net/virtio_net.c
+++ b/drivers/net/virtio_net.c
@@ -5917,7 +5917,7 @@ static int virtnet_xsk_pool_enable(struct net_device *dev,
 err_rq:
 	xsk_pool_dma_unmap(pool, 0);
 err_xsk_map:
-	virtqueue_unmap_single_attrs(rq->vq, hdr_dma, vi->hdr_len,
+	virtqueue_unmap_single_attrs(sq->vq, hdr_dma, vi->hdr_len,
 				     DMA_TO_DEVICE, 0);
 err_free_buffs:
 	kvfree(rq->xsk_buffs);
-- 
2.32.0.3.g01195cf9f


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-20  9:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-20  1:35 [PATCH net] virtio-net: correct DMA unmap vq mismatch in virtnet_xsk_pool_enable() Xuan Zhuo
2026-03-20  9:45 ` Michael S. Tsirkin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox