From: sashiko-bot@kernel.org
To: "Mark Syms" <mark.syms@citrix.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net] xen-netfront: unregister the XDP rxq before destroying its page_pool
Date: Wed, 25 Nov 2026 09:18:28 +0000 [thread overview]
Message-ID: <sashiko-outbox-232996@kernel.org> (raw)
In-Reply-To: <20261124091806.2736453-1-mark.syms@citrix.com>
Thank you for your contribution! Sashiko AI review found no new issues
in this patch, but noticed 1 related pre-existing issue it does not
introduce:
- [Critical] xen-netfront: use-after-free in talk_to_netback() [1]
--
commit 28bf900783c8239db158b535f3cda9d162761b0d
Author: Mark Syms <mark.syms@citrix.com>
xen-netfront: unregister the XDP rxq before destroying its page_pool
This commit unregisters each queue's XDP rxq before destroying its page_pool
in xennet_disconnect_backend() and clears queue->page_pool so that the pool
and its recycled receive buffers are not leaked on backend disconnect.
> diff --git a/drivers/net/xen-netfront.c b/drivers/net/xen-netfront.c
> index fdcb91042f290..b82b3bdb2fb31 100644
> --- a/drivers/net/xen-netfront.c
> +++ b/drivers/net/xen-netfront.c
> @@ -1860,7 +1860,10 @@ static void xennet_disconnect_backend(struct netfront_info *info)
> queue->tx.sring = NULL;
> queue->rx.sring = NULL;
>
> + if (xdp_rxq_info_is_reg(&queue->xdp_rxq))
> + xdp_rxq_info_unreg(&queue->xdp_rxq);
> page_pool_destroy(queue->page_pool);
> + queue->page_pool = NULL;
> }
> }
[Severity: Critical]
This problem wasn't introduced by this patch, but can talk_to_netback()
trigger a use-after-free on info->queues and leak page pools [1] when
xennet_create_page_pool() fails on a queue after the first?
In xennet_create_queues(), each initialized queue registers its page_pool
and links &queue->napi into netdev->napi_list via netif_napi_add(). If
xennet_create_page_pool() fails on a later queue, talk_to_netback() frees
info->queues directly without calling xennet_destroy_queues():
drivers/net/xen-netfront.c:xennet_create_queues() {
...
ret = xennet_create_page_pool(queue);
if (ret < 0) {
dev_err(&info->xbdev->dev, "can't allocate page pool\n");
*num_queues = i;
return ret;
}
netif_napi_add(queue->info->netdev, &queue->napi, xennet_poll);
...
}
drivers/net/xen-netfront.c:talk_to_netback() {
...
err = xennet_create_queues(info, &num_queues);
if (err < 0) {
xenbus_dev_fatal(dev, err, "creating queues");
kfree(info->queues);
info->queues = NULL;
goto out;
}
...
}
The earlier queues' NAPI instances remain on netdev->napi_list after
info->queues is freed, causing a use-after-free when netdev->napi_list is
later traversed, and their page pools are leaked.
[1] https://sashiko.dev/#/bug/linux-22a8f703-85e5-42c6-864c-250ab284af6d
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261124091806.2736453-1-mark.syms@citrix.com?part=1
next prev parent reply other threads:[~2026-11-25 9:18 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 9:18 [PATCH net] xen-netfront: unregister the XDP rxq before destroying its page_pool Mark Syms
2026-11-25 9:18 ` sashiko-bot [this message]
2026-12-01 12:00 ` patchwork-bot+netdevbpf
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=sashiko-outbox-232996@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=mark.syms@citrix.com \
--cc=sashiko-reviews@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.