Re: [PATCH net v2 1/4] net: skbuff: limit folio refcount when copying skb frag references

From: netdev-bot+sashiko

Date: Fri Nov 27 2026 - 16:21:56 EST


Thank you for your contribution! Sashiko AI review found more severe
issue(s) in other patches of this series. This mail is only an FYI, in case
you want to address the nit picks below when you respin.

Low priority / nit picks for your consideration:

- [Low] Concern: this commit converts only pskb_expand_head(),
__pskb_copy_fclone(), skb_zerocopy() and pskb_carve_inside_*() to the…

--

net: skbuff: limit folio refcount when copying skb frag references

This commit adds skb_frag_try_ref() and skb_frags_try_ref(). Both take
frag page references with try_get_page(), so they refuse a new reference
when the folio refcount is at its limit. The commit converts
pskb_expand_head(), __pskb_copy_fclone(), skb_zerocopy() and
pskb_carve_inside_*() to these helpers, and those functions now fail when
a reference can't be taken.

> Let's introduce skb_frag_try_ref() and skb_frags_try_ref(), which use
> try_get_page(), and use them in pskb_expand_head(), __pskb_copy_fclone(),
> skb_zerocopy() and pskb_carve_inside_*(). All of these can already fail,
> and their callers handle that.

[Severity: Low]
This isn't a bug, but could the commit message mention the frag reference
sites that still use plain skb_frag_ref() at this point in the series?

In net/core/skbuff.c, these still take unchecked references:

skb_segment():
skb_frag_ref(nskb, skb_shinfo(nskb)->nr_frags);

skb_try_coalesce():
skb_frag_ref(from, i);

skb_shift():
skb_frag_ref(tgt, to);

skb_split_no_header():
skb_frag_ref(skb1, k);

Outside skbuff.c, the same applies to tcp_clone_payload() in
net/ipv4/tcp_output.c, and to iptfs_skb_add_frags() and
iptfs_consume_frags() in net/xfrm/xfrm_iptfs.c.

The next patch in the series, "net: skbuff: limit folio refcount when
rearranging skb frags", converts skb_segment(), skb_try_coalesce(),
skb_shift() and tcp_clone_payload().

That patch also explains why skb_split() is left unchanged. Each split
allocates a new skb that is charged to the socket, and the references are
dropped once the data is acked.

The cover letter (merge 25f5c92e1ac0) leaves IP-TFS reassembly out on
purpose, because it needs one new inner skb per additional reference.

Would a short note saying that the remaining callers are converted, or
skipped on purpose, in the follow-up patch be worth adding here?

--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/20261126-skb_refcount_overflow-v2-0-a6f600a5634a%40kernel.org