Netdev List
 help / color / mirror / Atom feed
From: Florian Fainelli <florian.fainelli@broadcom.com>
To: Rosen Penev <rosenp@gmail.com>, netdev@vger.kernel.org
Cc: "Rafał Miłecki" <rafal@milecki.pl>,
	"Broadcom internal kernel review list"
	<bcm-kernel-feedback-list@broadcom.com>,
	"Andrew Lunn" <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	"Eric Dumazet" <edumazet@kernel.org>,
	"Jakub Kicinski" <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>,
	"Felix Fietkau" <nbd@openwrt.org>,
	"open list" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net v3] net: bgmac: fix RX frame length check
Date: Fri, 20 Nov 2026 10:18:26 -0800	[thread overview]
Message-ID: <0139ac37-fbe7-49fc-ba25-7b32df081920@broadcom.com> (raw)
In-Reply-To: <20261029173122.29636-1-rosenp@gmail.com>

On 10/29/26 10:31, Rosen Penev wrote:
> While reviewing commit 77dac783f113
> ("net: bgmac: rate limit RX error messages"), Florian spotted that the RX
> length sanity check compares the length reported in the RX header against
> BGMAC_RX_ALLOC_SIZE. That is the size of the whole fragment, including the
> space reserved for struct skb_shared_info. The data area handed to the
> hardware is only BGMAC_RX_BUF_SIZE bytes, and the frame starts
> BGMAC_RX_FRAME_OFFSET bytes into it, so at most BGMAC_RX_MAX_FRAME_SIZE
> bytes of a frame fit in one RX buffer.
> 
> A corrupted length between those two limits passes the check, and the
> following skb_put() runs past the skb tailroom and calls
> skb_over_panic() instead of dropping the frame.
> 
> The check has no lower bound either. A length below ETH_FCS_LEN wraps
> when the FCS is subtracted, so skb_put() asks for almost 64 KiB and hits
> the same skb_over_panic(). A length that leaves less than an Ethernet
> header makes eth_type_trans() parse bytes the hardware never wrote.
> 
> Reject lengths below ETH_HLEN + ETH_FCS_LEN or above
> BGMAC_RX_MAX_FRAME_SIZE, and print the bad length.
> 
> Only compile tested. Not tested on hardware.
> 
> Fixes: 6a6c708469c9 ("bgmac: add check for oversized packets")
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>

Rosen, can you address Sashiko's feedback and resubmit? This patch 
conflicts with one I have in my tree to support flow accelerator and I 
would prefer to get yours in because it's a tad more complete than mine, 
and yours has precedence.

Thanks!
-- 
Florian

      parent reply	other threads:[~2026-11-20 18:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-29 17:31 [PATCH net v3] net: bgmac: fix RX frame length check Rosen Penev
2026-11-02 17:33 ` netdev-bot+sashiko
2026-11-20 18:18 ` Florian Fainelli [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=0139ac37-fbe7-49fc-ba25-7b32df081920@broadcom.com \
    --to=florian.fainelli@broadcom.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nbd@openwrt.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=rafal@milecki.pl \
    --cc=rosenp@gmail.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