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 2/5] idpf: Use coherent DMA buffer for Rx header split without XDP.
Date: Wed, 02 Dec 2026 07:19:15 +0000	[thread overview]
Message-ID: <sashiko-outbox-245048@kernel.org> (raw)
In-Reply-To: <20261202065737.207610-3-kuniyu@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] idpf: wrong RSC segment count in idpf_rx_rsc() on header
  buffer overflow
--

commit 3759b354320e7c5e9977e8bab71b077ad23bfb55
Author: Kuniyuki Iwashima <kuniyu@google.com>

idpf: Use coherent DMA buffer for Rx header split without XDP.

This commit allocates a coherent DMA buffer array per buffer queue for Rx
header split on DMA-coherent devices under an IOMMU DMA domain without XDP,
copying Rx headers into napi_alloc_skb() to avoid pinning page_pool header
pages.

> diff --git a/drivers/net/ethernet/intel/idpf/idpf_txrx.c b/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> index 7a33ab9130693..78558c16412f3 100644
> --- a/drivers/net/ethernet/intel/idpf/idpf_txrx.c
> +++ b/drivers/net/ethernet/intel/idpf/idpf_txrx.c

[ ... ]

> @@ -3450,14 +3540,20 @@ static int idpf_rx_rsc(struct idpf_rx_queue *rxq, struct sk_buff *skb,
>  	if (unlikely(!(ipv4 ^ ipv6)))
>  		return -EINVAL;
>  
> +	if (unlikely(eth_type_vlan(skb->protocol)))
> +		l3_start = VLAN_HLEN;
> +
> +	if (unlikely(!pskb_may_pull(skb, l3_start +
> +					 (ipv4 ? sizeof(struct iphdr) :
> +						 sizeof(struct ipv6hdr)) +
> +					 sizeof(struct tcphdr))))
> +		return -EINVAL;
> +
>  	rsc_segments = DIV_ROUND_UP(skb->data_len, rsc_seg_len);

[Severity: Medium]
Does idpf_rx_rsc() miscalculate rsc_segments on header buffer overflow when
TCP options are present?

When hdr_len is 0 and pkt_len > L1_CACHE_BYTES, idpf_rx_splitq_clean_skb()
copies only ETH_HLEN bytes into the linear skb area and leaves the L3/L4
headers and payload in frags[0].  pskb_may_pull() here only pulls the fixed
L3 header and the 20-byte base struct tcphdr, leaving any TCP options (such
as the 12-byte TCP timestamp option) in skb->data_len when
DIV_ROUND_UP(skb->data_len, rsc_seg_len) runs.  For an RSC packet with N
full segments of rsc_seg_len bytes plus TCP options, rsc_segments and
skb_shinfo(skb)->gso_segs become N + 1 instead of N, causing
tcp_gro_receive() to flush the packet without aggregation (or
tcp_gso_segment() to drop a 1-MSS RSC packet with -EINVAL).  Also, if
hdr_len is 0 and pkt_len <= L1_CACHE_BYTES, the entire frame is copied into
linear data so skb->data_len is 0, setting rsc_segments and gso_segs to 0.

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

  reply	other threads:[~2026-12-02  7:19 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 [this message]
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

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-245048@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