From: sashiko-bot@kernel.org
To: "Antonio Quartulli" <antonio@mandelbit.com>,
intel-wired-lan@lists.osuosl.org
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net v7 6/7] igb: resume the device before changing XDP or XSK settings
Date: Thu, 03 Dec 2026 00:23:36 +0000 [thread overview]
Message-ID: <sashiko-outbox-246832@kernel.org> (raw)
In-Reply-To: <20261202002317.3140591-7-antonio@mandelbit.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] igb: vmalloc out-of-bounds write on igb_io_resume() after XDP
removal
--
commit 786a2141ab9cb4e4d47bb77a0f263b3f51ba368a
Author: Antonio Quartulli <antonio@mandelbit.com>
igb: resume the device before changing XDP or XSK settings
This commit runtime-resumes the device around igb_xdp() and updates
igb_xdp_setup(), igb_xsk_pool_enable() and igb_xsk_pool_disable() to
handle detached devices or rings without allocated resources after a
failed resume.
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index 11c136d7bea75..a6fa33cb4521a 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -2896,8 +2896,17 @@ static int igb_xdp_setup(struct net_device *dev, struct netdev_bpf *bpf)
> bool running = netif_running(dev);
> bool need_reset;
>
> - /* verify igb ring attributes are sufficient for XDP */
> - for (i = 0; i < adapter->num_rx_queues; i++) {
> + /* igb_close() doesn't close a detached device (after a failed resume,
> + * or during PCI error recovery): only update the software state
> + */
> + if (!netif_device_present(dev))
> + running = false;
[Severity: Medium]
Can removing an XDP program while the device is detached during PCI error
recovery cause a vmalloc out-of-bounds write when igb_io_resume() runs?
When an AF_XDP zero-copy pool is enabled on an active XDP queue,
igb_xsk_pool_enable() -> igb_realloc_rx_buffer_info(rx_ring, true) shrinks
the shared union buffer from sizeof(*ring->rx_buffer_info) * ring->count
to sizeof(*ring->rx_buffer_info_zc) * ring->count. On PCI error,
igb_io_error_detected() detaches the device and calls igb_down(), which
cleans the rings without freeing rx_buffer_info_zc.
If the XDP program is then removed while detached, setting running = false
skips closing/reopening and only clears adapter->xdp_prog and
rx_ring->xdp_prog, leaving the smaller rx_buffer_info_zc allocation in
place (and a later igb_xsk_pool_disable() also skips reallocating because
igb_xdp_is_enabled() is now false). When igb_io_resume() calls igb_up() ->
igb_configure() -> igb_configure_rx() -> igb_configure_rx_ring(),
igb_xsk_pool() returns NULL because adapter->xdp_prog is NULL:
drivers/net/ethernet/intel/igb/igb_main.c:igb_configure_rx_ring() {
...
WRITE_ONCE(ring->xsk_pool, igb_xsk_pool(adapter, ring));
...
/* Clear descriptor ring */
if (ring->xsk_pool)
memset(ring->rx_buffer_info_zc, 0,
sizeof(*ring->rx_buffer_info_zc) * ring->count);
else
memset(ring->rx_buffer_info, 0,
sizeof(*ring->rx_buffer_info) * ring->count);
...
}
memset() and igb_alloc_rx_buffers() then write
sizeof(struct igb_rx_buffer) * ring->count bytes into the smaller
sizeof(struct xdp_buff *) * ring->count buffer.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261202002317.3140591-1-antonio@mandelbit.com?part=6
next prev parent reply other threads:[~2026-12-03 0:23 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 0:23 [PATCH net v7 0/7] igb: fix runtime PM resume issues Antonio Quartulli
2026-12-02 0:23 ` [PATCH net v7 1/7] igb: don't wait for RTNL when runtime suspending Antonio Quartulli
2026-12-03 1:04 ` netdev-bot+sashiko
2026-12-02 0:23 ` [PATCH net v7 2/7] igb: don't touch rings that don't exist when disabling an XSK pool Antonio Quartulli
2026-12-03 1:04 ` netdev-bot+sashiko
2026-12-02 0:23 ` [PATCH net v7 3/7] igb: fix RTNL assertion when resuming from runtime suspend Antonio Quartulli
2026-12-03 1:04 ` netdev-bot+sashiko
2026-12-02 0:23 ` [PATCH net v7 4/7] igb: keep the stack's Rx queues that still have an XSK pool Antonio Quartulli
2026-12-03 1:04 ` netdev-bot+sashiko
2026-12-02 0:23 ` [PATCH net v7 5/7] igb: link queues to NAPIs under RTNL after runtime resume Antonio Quartulli
2026-12-02 0:23 ` [PATCH net v7 6/7] igb: resume the device before changing XDP or XSK settings Antonio Quartulli
2026-12-03 0:23 ` sashiko-bot [this message]
2026-12-03 1:04 ` netdev-bot+sashiko
2026-12-02 0:23 ` [PATCH net v7 7/7] igb: only allow runtime PM if the device can wake up Antonio Quartulli
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-246832@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=antonio@mandelbit.com \
--cc=bpf@vger.kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--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.