Netdev List
 help / color / mirror / Atom feed
From: Antoine Tenart <atenart@kernel.org>
To: Kenneth Lee <kennethbwlee@snu.ac.kr>
Cc: netdev@vger.kernel.org, dsahern@kernel.org, idosch@nvidia.com,
	 davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com,  horms@kernel.org, rhkrqnwk98@gmail.com
Subject: Re: [PATCH net] net: ip_gre: use checksum-aware trim for ERSPAN
Date: Fri, 31 Jul 2026 09:42:28 +0200	[thread overview]
Message-ID: <amxPmrfUFbSUNmgE@kwain> (raw)
In-Reply-To: <20260730085220.985948-1-kennethbwlee@snu.ac.kr>

On Thu, Jul 30, 2026 at 05:52:20PM +0900, Kenneth Lee wrote:
> ERSPAN currently uses pskb_trim() when truncating packets to the device
> MTU.  For a CHECKSUM_PARTIAL skb, that helper can leave csum_start and
> csum_offset pointing at a checksum field outside the new packet length.
> The skb can then reach skb_checksum_help() during transmit validation,
> which warns when the checksum offset is beyond skb_headlen().
> 
> Use pskb_trim_rcsum() in both ERSPAN transmit paths.  It rejects a
> CHECKSUM_PARTIAL skb whose checksum field is no longer in the trimmed
> linear data and returns -EINVAL.  The existing error paths then free the
> skb instead of transmitting inconsistent checksum metadata.

Can you include a description of the MTU and kind of packet that
triggers this?

> Fixes: f192970de860 ("ip_gre: check packet length and mtu correctly in erspan tx")
> 

Extra empty line.

Wasn't pskb_trim called before this commit?

> Found-by: Sechang Lim <rhkrqnwk98@gmail.com>

This is not a known tag,
https://docs.kernel.org/process/submitting-patches.html#using-reported-by-tested-by-reviewed-by-suggested-by-and-fixes

(You should used Reported-by: here).

> Signed-off-by: Kenneth Lee <kennethbwlee@snu.ac.kr>
> ---
>  net/ipv4/ip_gre.c | 4 ++--

Looks like the IPv6 counterpart has the same construction, can you
check?

>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c
> index 169e2921a851..16f80620f6d1 100644
> --- a/net/ipv4/ip_gre.c
> +++ b/net/ipv4/ip_gre.c
> @@ -576,7 +576,7 @@ static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev)
>  		goto err_free_skb;
>  
>  	if (skb->len > dev->mtu + dev->hard_header_len) {
> -		if (pskb_trim(skb, dev->mtu + dev->hard_header_len))
> +		if (pskb_trim_rcsum(skb, dev->mtu + dev->hard_header_len))
>  			goto err_free_skb;
>  		truncate = true;
>  	}
> @@ -723,7 +723,7 @@ static netdev_tx_t erspan_xmit(struct sk_buff *skb,
>  		goto free_skb;
>  
>  	if (skb->len > dev->mtu + dev->hard_header_len) {
> -		if (pskb_trim(skb, dev->mtu + dev->hard_header_len))
> +		if (pskb_trim_rcsum(skb, dev->mtu + dev->hard_header_len))
>  			goto free_skb;
>  		truncate = true;
>  	}
> -- 
> 2.53.0
> 

  reply	other threads:[~2026-07-31  7:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-30  8:52 [PATCH net] net: ip_gre: use checksum-aware trim for ERSPAN Kenneth Lee
2026-07-31  7:42 ` Antoine Tenart [this message]
2026-07-31  9:49   ` Kenneth Lee

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=amxPmrfUFbSUNmgE@kwain \
    --to=atenart@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=idosch@nvidia.com \
    --cc=kennethbwlee@snu.ac.kr \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rhkrqnwk98@gmail.com \
    /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