mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: david@kernel.org
Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, sdf.kernel@gmail.com, willemb@google.com,
	horms@kernel.org, akpm@linux-foundation.org, kas@kernel.org,
	songliubraving@fb.com, hannes@cmpxchg.org, riel@surriel.com,
	willy@infradead.org, ncardwell@google.com, kuniyu@google.com,
	pfalcato@suse.de, cel@kernel.org, jlayton@kernel.org,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mm@kvack.org, stable@vger.kernel.org
Subject: Re: [PATCH net v2 1/4] net: skbuff: limit folio refcount when copying skb frag references
Date: Fri, 27 Nov 2026 21:21:48 +0000	[thread overview]
Message-ID: <179581450836.3135.326843222571201832@kernel.org> (raw)
In-Reply-To: <20261126-skb_refcount_overflow-v2-1-a6f600a5634a@kernel.org>

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

  reply	other threads:[~2026-11-27 21:21 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26 21:18 [PATCH net v2 0/4] net: skbuff: limit pagecache folio refcount David Hildenbrand (Arm)
2026-11-26 21:18 ` [PATCH net v2 1/4] net: skbuff: limit folio refcount when copying skb frag references David Hildenbrand (Arm)
2026-11-27 21:21   ` netdev-bot+sashiko [this message]
2026-11-26 21:18 ` [PATCH net v2 2/4] net: skbuff: limit folio refcount when rearranging skb frags David Hildenbrand (Arm)
2026-11-26 21:18 ` [PATCH net v2 3/4] net: skbuff: limit folio refcount when splicing pages into skbs David Hildenbrand (Arm)
2026-11-27 21:21   ` netdev-bot+sashiko
2026-11-26 21:18 ` [PATCH net v2 4/4] net: skbuff: limit folio refcount when splicing from sockets David Hildenbrand (Arm)

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=179581450836.3135.326843222571201832@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=akpm@linux-foundation.org \
    --cc=cel@kernel.org \
    --cc=davem@davemloft.net \
    --cc=david@kernel.org \
    --cc=edumazet@kernel.org \
    --cc=hannes@cmpxchg.org \
    --cc=horms@kernel.org \
    --cc=jlayton@kernel.org \
    --cc=kas@kernel.org \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=ncardwell@google.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=pfalcato@suse.de \
    --cc=riel@surriel.com \
    --cc=sdf.kernel@gmail.com \
    --cc=songliubraving@fb.com \
    --cc=stable@vger.kernel.org \
    --cc=willemb@google.com \
    --cc=willy@infradead.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

all inboxes | Powered by JetHome®