Re: [PATCH net 2/2] virtio_net: Keep AF_XDP zero-copy pools bound across suspend

From: Haishuang Yan

Date: Sun Nov 08 2026 - 04:25:42 EST


On Sun, Nov 08, 2026 at 05:41:17AM +0000, netdev-bot+sashiko@xxxxxxxxxx wrote:
> - [High] virtnet_xsk_pools_unbind() calls virtnet_xsk_pool_disable() for
> pools whose AF_XDP sockets are still XSK_BOUND.
> - [High] virtio_net: stale DMA addresses in free_list after unaligned XSK
> pool rebind
> - [High] virtio_net: uninitialized xsk_hdr_dma_addr used in
> virtnet_xsk_pool_enable()
> - [Medium] virtnet_xsk_pools_unbind()
> (drivers/net/virtio_net.c:6063-6072) loops over max_queue_pairs and…

Thanks, I went through all four against the code and they all hold.

The three High ones come from the same mistake: the patch reuses
virtnet_xsk_pool_disable()/enable(), which assume the socket is
already unbound, while the sockets are still bound and the device is
still running. That opens the window against the RX path redirecting
to the socket, unmaps and remaps the pool behind buffers sitting on
its free_list, and lets TX NAPI run before xsk_hdr_dma_addr is set.

For v2 I'll stop unmapping and remapping the pool across suspend.
Freeze will keep the pool DMA mapping and only stash the driver's
per-queue xsk state after virtnet_freeze_down() has stopped NAPI, and
restore will attach it to the new queues before virtnet_open(). That
should remove all three problems instead of patching each one.

The Medium one is right too. A pool can be left bound on a queue at
or above curr_queue_pairs after native XDP is detached. As noted, that
comes from virtnet_xdp_set() not checking for bound pools, which
predates this patch. I'll fix it there as a separate patch in the
series, so suspend no longer has to handle that case.

v2 will be retested with KASAN for both aligned and unaligned pools.

pw-bot: cr