Intel-Wired-Lan Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Kuniyuki Iwashima" <kuniyu@google.com>
Cc: intel-wired-lan@lists.osuosl.org
Subject: Re: [PATCH v1 iwl-next 5/5] idpf: Unmap Rx payload pages under DMA-FQ IOMMU.
Date: Wed, 02 Dec 2026 07:13:06 +0000	[thread overview]
Message-ID: <sashiko-outbox-245038@kernel.org> (raw)
In-Reply-To: <20261202065737.207610-6-kuniyu@google.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] idpf: dangling bufq->xsk_buf pointer in idpf_xskfq_rel()
  [1]
--

commit 102db293b209cf2d45959e6eb23ac7fd38343bc6
Author: Kuniyuki Iwashima <kuniyu@google.com>

idpf: Unmap Rx payload pages under DMA-FQ IOMMU.

This commit opts out of page_pool DMA mapping in splitq mode when XDP is
disabled under IOMMU_DOMAIN_DMA_FQ, tracking active descriptor counts per
page and unmapping each payload page once all of its descriptors complete.

> diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> index 78558c16412f3..561e1c19df006 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
[ ... ]
> @@ -418,13 +501,20 @@ static void idpf_rx_buf_rel_bufq(struct idpf_buf_queue *bufq)
>  	}
>  
>  	/* Free all the bufs allocated and given to hw on Rx queue */
> -	for (u32 i = 0; i < bufq->desc_count; i++)
> -		idpf_rx_page_rel(&bufq->buf[i]);
> +	for (u32 i = 0; i < bufq->desc_count; i++) {
> +		if (bufq->buf[i].netmem) {
> +			idpf_rx_buf_sync_unmap(bufq, i, 0);
> +			idpf_rx_page_rel(&bufq->buf[i]);
> +		}
> +	}

[Severity: Critical]
This problem wasn't introduced by this patch, but can idpf_xskfq_rel()
leave a dangling pointer in bufq->xsk_buf (which shares an anonymous union
with bufq->buf) [1]?

drivers/net/ethernet/intel/idpf/xsk.c:idpf_xskfq_rel() {
	struct libeth_xskfq fq = {
		.fqes	= bufq->xsk_buf,
	};

	libeth_xskfq_destroy(&fq);
    ...
}

When disabling or reconfiguring an XSk pool on a running interface via
idpf_xsk_pool_setup(), idpf_rx_buf_rel_bufq() calls idpf_xskfq_rel(bufq)
and returns without clearing bufq->xsk_buf, and idpf_xsk_clear_queue()
then clears __IDPF_Q_XSK.  If re-enabling the queue pair in
idpf_qp_switch() fails before bufq->buf is reallocated, a later
idpf_vport_stop() calls idpf_rx_buf_rel_bufq() with __IDPF_Q_XSK cleared
and a non-NULL dangling bufq->buf, causing this loop to walk the freed XSk
pointer array as struct libeth_fqe entries (use-after-free and
out-of-bounds reads) before libeth_rx_fq_destroy() double-frees bufq->buf.

[1] https://sashiko.dev/#/bug/linux-35f48909-5f9a-4fd2-90be-88cfbcea1d44

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261202065737.207610-1-kuniyu@google.com?part=5

      reply	other threads:[~2026-12-02  7:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-02  6:57 [PATCH v1 iwl-next 0/5] idpf: Avoid IOVA exhaustion under DMA-FQ IOMMU Kuniyuki Iwashima
2026-12-02  6:57 ` [PATCH v1 iwl-next 1/5] idpf: Reuse idpf_rx_update_bufq_desc() in idpf_rx_post_buf_desc() Kuniyuki Iwashima
2026-12-02  6:57 ` [PATCH v1 iwl-next 2/5] idpf: Use coherent DMA buffer for Rx header split without XDP Kuniyuki Iwashima
2026-12-02  7:19   ` sashiko-bot
2026-12-02  7:33     ` Kuniyuki Iwashima
2026-12-02  6:57 ` [PATCH v1 iwl-next 3/5] page_pool: Set dma_sync_for_cpu only under PP_FLAG_DMA_MAP Kuniyuki Iwashima
2026-12-02  6:57 ` [PATCH v1 iwl-next 4/5] libeth: Allow opting out of page_pool DMA mapping on Rx Kuniyuki Iwashima
2026-12-02  6:57 ` [PATCH v1 iwl-next 5/5] idpf: Unmap Rx payload pages under DMA-FQ IOMMU Kuniyuki Iwashima
2026-12-02  7:13   ` sashiko-bot [this message]

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-245038@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kuniyu@google.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox