From: sashiko-bot@kernel.org
To: "Octavian Purdila" <tavip@google.com>
Cc: bpf@vger.kernel.org
Subject: Re: [PATCH net 02/10] net: gro: reset unreadable and pp_recycle in napi_reuse_skb
Date: Fri, 04 Dec 2026 21:09:34 +0000 [thread overview]
Message-ID: <sashiko-outbox-250668@kernel.org> (raw)
In-Reply-To: <808e0a7c2cbb252654d1d55368858b774cf48853.1796329894.git.tavip@google.com>
Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Medium] net: gro: napi_reuse_skb() clears pp_recycle on page_pool
head_frag skb
--
commit b36e9ed0c17bf92ac591da7f73dbb5d385defdc5
Author: Octavian Purdila <tavip@google.com>
net: gro: reset unreadable and pp_recycle in napi_reuse_skb
This commit clears skb->unreadable and skb->pp_recycle in napi_reuse_skb()
so stale state is not carried over when napi->skb is reused.
> diff --git a/net/core/gro.c b/net/core/gro.c
> index fb730017fd3ba..c1d07bca1b4eb 100644
> --- a/net/core/gro.c
> +++ b/net/core/gro.c
> @@ -697,6 +697,8 @@ static void napi_reuse_skb(struct napi_struct *napi, struct sk_buff *skb)
>
> skb->encapsulation = 0;
> skb->ip_summed = CHECKSUM_NONE;
> + skb->unreadable = 0;
> + skb->pp_recycle = 0;
[Severity: Medium]
Can clearing skb->pp_recycle here break freeing skb->head when skb->head_frag
is set?
On a TAP device with IFF_NAPI_FRAGS and a multi-buffer generic XDP program,
tun_get_user() can store a system_page_pool-backed skb (head_frag = 1,
pp_recycle = 1) from do_xdp_generic() -> skb_pp_cow_data() in
tfile->napi.skb.
If the XDP program trims linear data to the headers while leaving payload in
frag[0], skb_gro_receive() merges the frag with NAPI_GRO_FREE and routes that
skb to napi_reuse_skb().
When the cached skb is later freed, skb_free_head() skips skb_pp_recycle()
and frees the page_pool page via skb_free_frag() -> page_frag_free(). With
CONFIG_DEBUG_VM or init_on_alloc this triggers bad_page ("page_pool leak")
and leaks the page; otherwise pages_state_hold_cnt is permanently imbalanced.
Should napi_reuse_skb() reject skb->head_frag alongside skb->pfmemalloc and
pass such skbs to consume_skb()?
--
Sashiko AI review · https://sashiko.dev/#/patchset/cover.1796329894.git.tavip@google.com?part=2
next prev parent reply other threads:[~2026-12-04 21:09 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 21:09 [PATCH net 00/10] net: fix unreadable net_iov skb handling across networking paths Octavian Purdila
2026-12-03 21:09 ` [PATCH net 01/10] net: gro: free skb on napi_frags_skb() header pull failure Octavian Purdila
2026-12-04 18:31 ` Mina Almasry
2026-12-03 21:09 ` [PATCH net 02/10] net: gro: reset unreadable and pp_recycle in napi_reuse_skb Octavian Purdila
2026-12-04 18:32 ` Mina Almasry
2026-12-04 21:07 ` Octavian Purdila
2026-12-04 21:09 ` sashiko-bot [this message]
2026-12-04 22:07 ` netdev-bot+sashiko
2026-12-03 21:09 ` [PATCH net 03/10] inet: frag: reject fragments with mixed readability in reassembly Octavian Purdila
2026-12-04 18:38 ` Mina Almasry
2026-12-04 21:09 ` Octavian Purdila
2026-12-04 22:07 ` netdev-bot+sashiko
2026-12-03 21:09 ` [PATCH net 04/10] net: skbuff, skmsg, strparser: reject unreadable frags Octavian Purdila
2026-12-04 18:58 ` Mina Almasry
2026-12-04 21:25 ` Octavian Purdila
2026-12-04 21:09 ` sashiko-bot
2026-12-04 22:07 ` netdev-bot+sashiko
2026-12-03 21:09 ` [PATCH net 05/10] tls: reject unreadable skbs in tls_strp Octavian Purdila
2026-12-04 18:44 ` Mina Almasry
2026-12-04 22:24 ` Octavian Purdila
2026-12-04 21:09 ` sashiko-bot
2026-12-04 22:07 ` netdev-bot+sashiko
2026-12-03 21:09 ` [PATCH net 06/10] tcp: reject unreadable skbs on TCP-MD5 and TCP-AO Octavian Purdila
2026-12-04 18:46 ` Mina Almasry
2026-12-04 22:26 ` Octavian Purdila
2026-12-04 21:09 ` sashiko-bot
2026-12-04 22:07 ` netdev-bot+sashiko
2026-12-03 21:09 ` [PATCH net 07/10] net: kunit: test unreadable net_iov napi_gro_frags Octavian Purdila
2026-12-04 18:47 ` Mina Almasry
2026-12-04 21:09 ` sashiko-bot
2026-12-04 22:07 ` netdev-bot+sashiko
2026-12-03 21:09 ` [PATCH net 08/10] net: kunit: test unreadable net_iov defrag and skb helpers Octavian Purdila
2026-12-04 21:09 ` sashiko-bot
2026-12-04 22:07 ` netdev-bot+sashiko
2026-12-03 21:09 ` [PATCH net 09/10] selftests: drv-net: devmem: test unreadable kTLS RX Octavian Purdila
2026-12-04 18:48 ` Mina Almasry
2026-12-04 22:28 ` Octavian Purdila
2026-12-04 21:09 ` sashiko-bot
2026-12-04 22:08 ` netdev-bot+sashiko
2026-12-03 21:09 ` [PATCH net 10/10] selftests: drv-net: devmem: test unreadable skbs on TCP-MD5 and TCP-AO Octavian Purdila
2026-12-04 21:09 ` sashiko-bot
2026-12-04 22:08 ` netdev-bot+sashiko
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-250668@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
--cc=tavip@google.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