From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
To: Eric Dumazet <edumazet@kernel.org>,
"David S . Miller" <davem@davemloft.net>,
Jakub Kicinski <kuba@kernel.org>,
Paolo Abeni <pabeni@redhat.com>
Cc: Simon Horman <horms@kernel.org>,
Willem de Bruijn <willemb@google.com>,
netdev@vger.kernel.org, edumazet@kernel.org,
Kyle Zeng <kylebot@openai.com>,
stable@vger.kernel.org,
Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Subject: Re: [PATCH net] net/packet: check TX_RING fragments before memory accounting
Date: Wed, 28 Oct 2026 14:47:44 -0400 [thread overview]
Message-ID: <willemdebruijn.kernel.139c2c63190ce@gmail.com> (raw)
In-Reply-To: <20261028181450.2221013-1-edumazet@kernel.org>
Eric Dumazet wrote:
> From: Kyle Zeng <kylebot@openai.com>
>
> tpacket_fill_skb() adds the full non-linear payload length to
> skb->truesize and sk_wmem_alloc before checking MAX_SKB_FRAGS. With
> PACKET_VNET_HDR, userspace can submit a ring-sized frame even when it
> greatly exceeds the device MTU.
>
> A near-INT_MAX frame can saturate sk_wmem_alloc before the fragment
> loop rejects it. A subsequent refcount_add(0x40000001) can temporarily
> turn REFCOUNT_SATURATED into 1. A concurrent TX completion can then
> drop that apparent last reference and free the still-live packet
> socket before refcount_warn_saturate() restores the counter.
>
> Check that the remaining payload fits in MAX_SKB_FRAGS pages before
> accounting it. Include the initial page offset in the calculation,
> and move the existing -EFAULT handling out of the fragment loop.
> This preserves the accepted packet sizes and error code while
> preventing an invalid frame from injecting an oversized byte charge.
>
> Fixes: 69e3c75f4d54 ("net: TX_RING and packet mmap")
> Cc: stable@vger.kernel.org
> Cc: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
> Signed-off-by: Kyle Zeng <kylebot@openai.com>
> [edumazet: use net_warn_ratelimited() instead of pr_err(), add a Fixes: tag]
> Signed-off-by: Eric Dumazet <edumazet@kernel.org>
Reviewed-by: Willem de Bruijn <willemb@google.com>
next prev parent reply other threads:[~2026-10-28 18:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-28 18:14 [PATCH net] net/packet: check TX_RING fragments before memory accounting Eric Dumazet
2026-10-28 18:21 ` netdev-bot+sinfo
2026-10-28 18:47 ` Willem de Bruijn [this message]
2026-10-29 16:10 ` patchwork-bot+netdevbpf
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.139c2c63190ce@gmail.com \
--to=willemdebruijn.kernel@gmail.com \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=horms@kernel.org \
--cc=kuba@kernel.org \
--cc=kylebot@openai.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=willemb@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