Netdev List
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Josef Bacik <josef@toxicpanda.com>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Simon Horman <horms@kernel.org>,
	Andrew Lunn <andrew+netdev@lunn.ch>
Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
	Fernando Fernandez Mancera <fmancera@suse.de>,
	Mina Almasry <almasrymina@google.com>,
	David Laight <david.laight.linux@gmail.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH net-next 1/4] net: skbuff: don't clone a nested frag_list member
Date: Thu, 19 Nov 2026 10:23:24 +0100	[thread overview]
Message-ID: <83fb9e03-3c37-4c7e-92b1-0eff6e7384cc@redhat.com> (raw)
In-Reply-To: <20261113-b4-skb-segment-clone-fixes-v1-1-f777fb06f3e7@toxicpanda.com>

On 11/13/26 01:21, Josef Bacik wrote:
> skb_segment() clones a frag_list member whose linear part fills the
> segment.  pskb_trim() drops a nested frag_list from the clone, and the
> walk moves on to the next member while head_skb->len still counts the
> nested bytes.
> 
> With SG the walk then runs out of members and the segmentation fails.
> Without SG the segments that aren't clones are copied out of head_skb by
> offset, so the nested bytes are dropped and a later member goes out
> twice.  Take a gso_size of 1000, a head of 1000 bytes, a member A of
> 1000 bytes with a nested frag_list of 1000, a member B of 1000 bytes,
> and a member C with 200 linear bytes and a frag of 100.  The segments
> come out as head, A, B, B, C.  Without C this was a NULL pointer
> dereference before commit e447e46ce976 ("net: skbuff: don't run off
> frag_list in skb_segment()"), and B goes out twice since then.
> 
> Don't clone a member that has a frag_list.  Without SG the segment is
> then copied by offset, and the copy recurses into the nested frag_list.
> With SG the segmentation still fails with -EINVAL.  Nothing in the tree
> is known to build such an skb.

If nothing builds the problematic layout, this feels like defensive
programming, and we should avoid it.

/P


  reply	other threads:[~2026-11-19  9:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-13  0:21 [PATCH net-next 0/4] net: skbuff: skb_segment() fixes for frag_lists without SG Josef Bacik
2026-11-13  0:21 ` [PATCH net-next 1/4] net: skbuff: don't clone a nested frag_list member Josef Bacik
2026-11-19  9:23   ` Paolo Abeni [this message]
2026-11-13  0:21 ` [PATCH net-next 2/4] net: skbuff: don't clone a stale " Josef Bacik
2026-11-19  9:26   ` Paolo Abeni
2026-11-13  0:21 ` [PATCH net-next 3/4] net: compare the payload in the GSO KUnit test Josef Bacik
2026-11-13  0:21 ` [PATCH net-next 4/4] net: test more frag_list layouts without SG Josef Bacik
2026-11-13  2:52 ` [PATCH net-next 0/4] net: skbuff: skb_segment() fixes for frag_lists " Mina Almasry

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=83fb9e03-3c37-4c7e-92b1-0eff6e7384cc@redhat.com \
    --to=pabeni@redhat.com \
    --cc=almasrymina@google.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=david.laight.linux@gmail.com \
    --cc=edumazet@kernel.org \
    --cc=fmancera@suse.de \
    --cc=horms@kernel.org \
    --cc=josef@toxicpanda.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=willemdebruijn.kernel@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