Skip to contentSkip to conversation

net: bgmac: fix oversized RX frame check

PATCH Superseded Rosen Penev 4 participants 7 messages Oct 23 – Oct 27

Subsystems (3)

v1 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: bgmac: fix oversized RX frame check

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 a valid frame is at most BGMAC_RX_MAX_FRAME_SIZE bytes long.

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.

Compare against BGMAC_RX_MAX_FRAME_SIZE instead.

Only compile tested. Not tested on hardware.

Fixes 6a6c708469c9 ("bgmac: add check for oversized packets")
---
 drivers/net/ethernet/broadcom/bgmac.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ethernet/broadcom/bgmac.c +1 -1
index b3a92ae95de3..6873c7bb7a14 100644
@@ -455,7 +455,7 @@ static int bgmac_dma_rx_read(struct bgmac *bgmac, struct bgmac_dma_ring *ring,
 				break;
 			}
 
-			if (len > BGMAC_RX_ALLOC_SIZE) {
+			if (len > BGMAC_RX_MAX_FRAME_SIZE) {
 				if (net_ratelimit())
 					netdev_err(bgmac->net_dev, "Found oversized packet at slot %d, DMA issue!\n",
 						   ring->start);
Signature · 1 line
2.56.0
#1 lore raw
This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

Hi!

This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.

Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then.

The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.

#2 lore raw
Quoted 9 lines · On Thu, Oct 22, 2026 at 5:57 PM <[email protected]> wrote:

Hi!

This is an automated message. This series looks like a fix, but its commit messages seem to be missing some information:

- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.

I added Suggested-by in the commit. LLM only used for the description.

Quoted 9 lines

Please do not repost the series just to address the above. Instead, reply to this email with the missing information, so that reviewers can take it into account. If the series needs another revision for other reasons, please include the information in the commit messages then.

The evaluation is done by an LLM so it may be wrong, if you think that is the case please reply and explain.

maintainer
#3 lore raw
Quoted 4 lines · On Thu, 22 Oct 2026 18:00:53 -0700 Rosen Penev wrote:
Quoted 3 lines

- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.

I added Suggested-by in the commit. LLM only used for the description.

Suggested by is for suggestion of how to write the code, if Florian reported it appropriate tag is Reported-by

#4 lore raw
Quoted 8 lines · Jakub Kicinski' via BCM-KERNEL-FEEDBACK-LIST,PDL
Quoted 4 lines · On Thu, 22 Oct 2026 18:00:53 -0700 Rosen Penev wrote:
Quoted 3 lines

- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.

I added Suggested-by in the commit. LLM only used for the description.

Suggested by is for suggestion of how to write the code, if Florian reported it appropriate tag is Reported-by

This was a suggestion, so I think it is appropriately being used here.

Signature · 1 line
Florian
#5 lore raw
Quoted 6 lines · Florian Fainelli
Quoted 4 lines · Jakub Kicinski' via BCM-KERNEL-FEEDBACK-LIST,PDL
Quoted 3 lines · On Thu, 22 Oct 2026 18:00:53 -0700 Rosen Penev wrote:
Quoted 3 lines

- How the issue was discovered, e.g. hit in production, hit during development, syzbot report, manual code inspection, LLM or static analysis tool scan.

Quoted 6 lines
Quoted 4 lines
Quoted 1 line

I added Suggested-by in the commit. LLM only used for the description.

Suggested by is for suggestion of how to write the code, if Florian reported it appropriate tag is Reported-by

This was a suggestion, so I think it is appropriately being used here.

So do I apply both tags?

Quoted 2 lines

--
Florian

maintainer
#6 lore raw
Quoted 6 lines · On Fri, 23 Oct 2026 13:46:54 -0700 Rosen Penev wrote:
Quoted 4 lines
Quoted 2 lines

Suggested by is for suggestion of how to write the code, if Florian reported it appropriate tag is Reported-by

This was a suggestion, so I think it is appropriately being used here.

So do I apply both tags?

No need for a tag, just start the commit message with "While reviewing commit XYZ Florian spotted that..."

I think most people would assume Reported-by implies user report. Again, the series info bot wants to basically know if this problem has been hit in production or it's a random code inspection thing.