From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Pavel Begunkov <asml.silence@gmail.com>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>,
Simon Horman <horms@kernel.org>,
netdev@vger.kernel.org
Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>,
Minh Nguyen <minhnguyen.080505@gmail.com>,
asml.silence@gmail.com
Subject: Re: [PATCH net 1/1] net: skbuff: fix pskb_carve leaking zcopy pages
Date: Thu, 28 May 2026 22:05:46 -0400 [thread overview]
Message-ID: <willemdebruijn.kernel.1b32eaa32d5ee@gmail.com> (raw)
In-Reply-To: <1e2086aa69217d7f9c8da3d38f5be7160f1b4cd1.1779993185.git.asml.silence@gmail.com>
Pavel Begunkov wrote:
> When SKBFL_MANAGED_FRAG_REFS is set, frag pages are not refcounted but
> their lifetime is controlled by the attached ubuf_info. To make a copy
> of the skb_shared_info, we either should clear the flag and reference
> the frags, or keep the flag and have frags unreferenced.
>
> pskb_carve_inside_header() and pskb_carve_inside_nonlinear() don't
> follow the rule and thus can leak page references. Let's clear
> SKBFL_MANAGED_FRAG_REFS from the original skb to fix it. It's the
> simplest way to address it, but there are more performant ways to do
> that if it ever becomes a problem.
>
> Link: https://lore.kernel.org/all/20260523085809.26331-1-nvminh232@clc.fitus.edu.vn/
> Fixes: 753f1ca4e1e50 ("net: introduce managed frags infrastructure")
> Reported-by: Minh Nguyen <minhnguyen.080505@gmail.com>
> Reported-by: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> Signed-off-by: Pavel Begunkov <asml.silence@gmail.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
> ---
> net/core/skbuff.c | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/net/core/skbuff.c b/net/core/skbuff.c
> index 0d3cc115f2e7..c02f0a507ba8 100644
> --- a/net/core/skbuff.c
> +++ b/net/core/skbuff.c
> @@ -6823,6 +6823,11 @@ static int pskb_carve_inside_header(struct sk_buff *skb, const u32 off,
> skb_copy_from_linear_data_offset(skb, off, data, new_hlen);
> skb->len -= off;
>
> + /* Remove SKBFL_MANAGED_FRAG_REFS instead of trying to honour it
> + * while refcounting frags below.
> + */
FWIW the multi-line comments are not really needed. The function of
skb_zcopy_downgrade_managed is quite clear.
prev parent reply other threads:[~2026-05-29 2:05 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-28 18:43 [PATCH net 1/1] net: skbuff: fix pskb_carve leaking zcopy pages Pavel Begunkov
2026-05-29 2:05 ` Willem de Bruijn [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=willemdebruijn.kernel.1b32eaa32d5ee@gmail.com \
--to=willemdebruijn.kernel@gmail.com \
--cc=asml.silence@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=minhnguyen.080505@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.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