From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Josef Bacik <josef@toxicpanda.com>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
Andrew Lunn <andrew+netdev@lunn.ch>
Cc: Juergen Gross <jgross@suse.com>,
Stefano Stabellini <sstabellini@kernel.org>,
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, xen-devel@lists.xenproject.org,
Josef Bacik <josef@toxicpanda.com>
Subject: Re: [PATCH net-next v3 11/15] net: skbuff: don't run off frag_list in skb_segment()
Date: Tue, 03 Nov 2026 21:53:41 -0500 [thread overview]
Message-ID: <willemdebruijn.kernel.6099d613565@gmail.com> (raw)
In-Reply-To: <20261103-b4-skbuff-bug-on-followups-v3-11-54ad0ab57614@toxicpanda.com>
Josef Bacik wrote:
> skb_segment() keeps going until it has segmented head_skb->len bytes.
> It takes the data from head_skb and then from each member of the
> frag_list. If head_skb->len counts data that this walk can't find, the
> walk runs out of members while it still owes data and dereferences a
> NULL list_skb. There are two ways to get there:
>
> - head_skb->len is bigger than what head_skb and its frag_list hold.
> - A member has a frag_list of its own. head_skb->len counts those
> bytes, but for each member the walk only looks at the linear part and
> frags[].
>
> No path in the tree is known to build a GSO skb like either. GRO
> flushes instead of chaining an skb that already has a frag_list. IP
> reassembly does nest frag_lists, but a reassembled skb isn't GSO.
>
> Check list_skb in the three places where the walk moves on to it, and
> fail the segmentation with -EINVAL. The KUnit cases in the next patch
> hit the NULL pointer dereference without this patch, and at least one of
> them hits it again with any one of the three checks taken out.
>
> Without SG the payload is copied by helpers that check the length
> themselves and recurse into a nested frag_list. That path still fails
> for a len that is too big, and still segments a nested frag_list.
>
> Found by the Sashiko AI review of the BUG_ON() series.
>
> Link: https://lore.kernel.org/all/20261007-b4-skbuff-bug-on-v2-0-b9a5f732895b@toxicpanda.com/
> Signed-off-by: Josef Bacik <josef@toxicpanda.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
next prev parent reply other threads:[~2026-11-04 2:53 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-03 2:28 [PATCH net-next v3 00/15] net: skbuff: follow-ups to the BUG_ON() removal Josef Bacik
2026-11-03 2:28 ` [PATCH net-next v3 01/15] net: skbuff: make skb_copy_and_csum_bits() report unreadable frags Josef Bacik
2026-11-03 2:58 ` Mina Almasry
2026-11-03 2:28 ` [PATCH net-next v3 02/15] net: skbuff: add skb_checksum_full() that reports failure Josef Bacik
2026-11-03 2:44 ` Mina Almasry
2026-11-03 17:28 ` Josef Bacik
2026-11-03 2:28 ` [PATCH net-next v3 03/15] net: skbuff: fail checksum validation when the skb can't be checksummed Josef Bacik
2026-11-03 2:28 ` [PATCH net-next v3 04/15] net: skbuff: fail segmentation when a segment " Josef Bacik
2026-11-03 2:36 ` Mina Almasry
2026-11-03 2:28 ` [PATCH net-next v3 05/15] net: skbuff: drop hw csum if trim can't checksum tail Josef Bacik
2026-11-03 2:28 ` [PATCH net-next v3 06/15] net: skbuff: add skb_crc32c_full() that reports failure Josef Bacik
2026-11-03 2:28 ` [PATCH net-next v3 07/15] net: skbuff: let skb_zerocopy() copy a short skb without head_frag Josef Bacik
2026-11-03 2:28 ` [PATCH net-next v3 08/15] net: skbuff: make skb_try_coalesce()'s len unsigned Josef Bacik
2026-11-03 2:28 ` [PATCH net-next v3 09/15] net: skbuff: reject data_len > len in copy_and_csum_dev Josef Bacik
2026-11-03 2:28 ` [PATCH net-next v3 10/15] net: skbuff: reject a negative length in skb_copy_and_csum_bits() Josef Bacik
2026-11-03 2:28 ` [PATCH net-next v3 11/15] net: skbuff: don't run off frag_list in skb_segment() Josef Bacik
2026-11-04 2:53 ` Willem de Bruijn [this message]
2026-11-03 2:28 ` [PATCH net-next v3 12/15] net: test the skb layouts skb_segment() refuses Josef Bacik
2026-11-04 2:57 ` Willem de Bruijn
2026-11-03 2:28 ` [PATCH net-next v3 13/15] xen-netfront: don't BUG() when skb_copy_bits() fails in bounce_skb() Josef Bacik
2026-11-03 6:27 ` Jürgen Groß
2026-11-03 2:28 ` [PATCH net-next v3 14/15] net/tls: don't BUG() on leftover length in __skb_nsg() Josef Bacik
2026-11-03 2:28 ` [PATCH net-next v3 15/15] net: update comments that still describe the skb BUG_ON()s Josef Bacik
2026-11-03 3:02 ` [PATCH net-next v3 00/15] net: skbuff: follow-ups to the BUG_ON() removal 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=willemdebruijn.kernel.6099d613565@gmail.com \
--to=willemdebruijn.kernel@gmail.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=jgross@suse.com \
--cc=josef@toxicpanda.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/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