From: "David Hildenbrand (Arm)" <david@kernel.org>
To: netdev-bot+sashiko@kernel.org
Cc: davem@davemloft.net, edumazet@kernel.org, kuba@kernel.org,
pabeni@redhat.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, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-mm@kvack.org,
stable@vger.kernel.org
Subject: Re: [PATCH net 4/4] net: skbuff: limit folio refcount when splicing from sockets
Date: Sun, 22 Nov 2026 14:09:15 +0100 [thread overview]
Message-ID: <aa3821a5-6459-4845-8255-00a26bf243d3@kernel.org> (raw)
In-Reply-To: <179533918041.3135.8460911693239501161@kernel.org>
On 11/22/26 10:19, netdev-bot+sashiko@kernel.org wrote:
> 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] The new comment above skb_splice_bits()
> (net/core/skbuff.c:3295-3300) says the function "Returns the number of…
>
> Pre-existing issues:
> - [Medium] skb_splice_bits() still returns 0, which callers report as
> EOF, when nothing was spliced because linear_to_page() failed to…
>
> --
>
> net: skbuff: limit folio refcount when splicing from sockets
>
> This patch uses try_get_page() in spd_fill_page() so that splicing from
> sockets into pipes cannot push a folio refcount past its limit. On
> failure it returns -EFAULT, and the error is propagated as an int
> through __splice_segment() and __skb_splice_bits(). skb_splice_bits()
> returns the error when nothing was spliced, so the callers don't report
> EOF.
>
>> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
>> index c937d74eed6ac..b73fef7a1b460 100644
>> --- a/net/core/skbuff.c
>> +++ b/net/core/skbuff.c
>
> [ ... ]
>
>> @@ -3284,7 +3294,9 @@ static bool __skb_splice_bits(struct sk_buff *skb, struct pipe_inode_info *pipe,
>>
>> /*
>> * Map data from the skb to a pipe. Should handle both the linear part,
>> - * the fragments, and the frag list.
>> + * the fragments, and the frag list. Returns the number of bytes spliced,
>> + * or an error if we could not splice anything because we could not take
>> + * a page reference.
>> */
>
> [Severity: Low]
> This isn't a bug, but is this return description complete?
>
> When spd.nr_pages is non-zero, skb_splice_bits() returns whatever
> splice_to_pipe() returns. splice_to_pipe() in fs/splice.c can fail for
> reasons that have nothing to do with page references:
>
> if (unlikely(!pipe->readers)) {
> send_sig(SIGPIPE, current, 0);
> ret = -EPIPE;
> goto out;
> }
> ...
> if (!ret)
> ret = -EAGAIN;
>
> The reverse case also exists. If linear_to_page() fails in
> spd_fill_page(), nothing gets spliced, yet skb_splice_bits() returns 0
> and not an error.
>
> Could the comment also mention the -EPIPE and -EAGAIN cases that come
> from splice_to_pipe()?
I guess we can just make it simpler by saying
"... or an error if splicing failed."
I assume that could be fixed up when applying.
>
>> int skb_splice_bits(struct sk_buff *skb, struct sock *sk, unsigned int offset,
>> struct pipe_inode_info *pipe, unsigned int tlen,
>> @@ -3299,14 +3311,14 @@ int skb_splice_bits(struct sk_buff *skb, struct sock *sk, unsigned int offset,
>> .ops = &default_pipe_buf_ops,
>> .spd_release = sock_spd_release,
>> };
>> - int ret = 0;
>> + int ret;
>>
>> - __skb_splice_bits(skb, pipe, &offset, &tlen, &spd, sk);
>> + ret = __skb_splice_bits(skb, pipe, &offset, &tlen, &spd, sk);
>>
>> if (spd.nr_pages)
>> - ret = splice_to_pipe(pipe, &spd);
>> -
>> - return ret;
>> + return splice_to_pipe(pipe, &spd);
>> + /* Returning 0 would make callers report EOF. */
>> + return ret < 0 ? ret : 0;
>
> [Severity: Medium]
> This is a pre-existing issue, not one introduced by this patch. Can the
> spurious EOF that this new comment describes still happen when
> linear_to_page() fails?
Sounds like something for net people to investigate.
--
Cheers,
David
prev parent reply other threads:[~2026-11-22 13:09 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-18 8:32 [PATCH net 0/4] net: skbuff: limit pagecache folio refcount David Hildenbrand (Arm)
2026-11-18 8:32 ` [PATCH net 1/4] net: skbuff: limit folio refcount when copying skb frag references David Hildenbrand (Arm)
2026-11-19 13:53 ` David Hildenbrand (Arm)
2026-11-20 16:21 ` Stanislav Fomichev
2026-11-20 21:01 ` David Hildenbrand (Arm)
2026-11-22 9:19 ` netdev-bot+sashiko
2026-11-22 12:58 ` David Hildenbrand (Arm)
2026-11-18 8:32 ` [PATCH net 2/4] net: skbuff: limit folio refcount when rearranging skb frags David Hildenbrand (Arm)
2026-11-22 9:19 ` netdev-bot+sashiko
2026-11-22 12:48 ` David Hildenbrand (Arm)
2026-11-18 8:32 ` [PATCH net 3/4] net: skbuff: limit folio refcount when splicing pages into skbs David Hildenbrand (Arm)
2026-11-22 9:19 ` netdev-bot+sashiko
2026-11-22 13:05 ` David Hildenbrand (Arm)
2026-11-18 8:32 ` [PATCH net 4/4] net: skbuff: limit folio refcount when splicing from sockets David Hildenbrand (Arm)
2026-11-22 9:19 ` netdev-bot+sashiko
2026-11-22 13:09 ` David Hildenbrand (Arm) [this message]
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=aa3821a5-6459-4845-8255-00a26bf243d3@kernel.org \
--to=david@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=hannes@cmpxchg.org \
--cc=horms@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-bot+sashiko@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=pfalcato@suse.de \
--cc=riel@surriel.com \
--cc=songliubraving@fb.com \
--cc=stable@vger.kernel.org \
--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®