Skip to contentSkip to conversation

net: dsa: tag_brcm: legacy FCS: request needed tailroom

PATCH Applied Weiming Shi 3 participants 3 messages Sep 8 – Sep 9

Subsystems (5)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: dsa: tag_brcm: legacy FCS: request needed tailroom

The legacy FCS tagger calculates the CRC over skb->len bytes starting at skb->data. When a nonlinear skb reaches the tagger, this reads past the linear head into unrelated slab memory.

The tagger appends an Ethernet FCS but does not declare that tailroom. As a result, DSA leaves NETIF_F_SG and NETIF_F_FRAGLIST enabled on the user port, and nonlinear skbs can reach the CRC calculation.

Declare the required tailroom. DSA will then clear those features and the networking core will linearize skbs before the tagger runs.

A KASAN-enabled dsa_loop test using this tagger reports:

  BUG: KASAN: slab-out-of-bounds in crc32_le
  Read of size 1 at addr ffff8880397086c0 by task exp/135

  Call Trace:
   crc32_le (lib/crc/crc32-main.c:38)
   brcm_leg_fcs_tag_xmit (net/dsa/tag_brcm.c:343)
   dsa_user_xmit (net/dsa/user.c:942)
   dev_hard_start_xmit (net/core/dev.c:3937)
   __dev_queue_xmit (net/core/dev.c:4926)
   packet_sendmsg (net/packet/af_packet.c:3110)
   __sys_sendto (net/socket.c:2281)

  The buggy address belongs to the object at ffff888039708400
   which belongs to the cache skbuff_small_head of size 704
  The buggy address is located 0 bytes to the right of
   allocated 704-byte region [ffff888039708400, ffff8880397086c0)
Fixes ef07df397a62 ("net: dsa: tag_brcm: add support for legacy FCS tags")
Reported-by [email protected]
Assisted-by Claude:gpt-5
---
 net/dsa/tag_brcm.c | 1 +
 1 file changed, 1 insertion(+)
net/dsa/tag_brcm.c +1 -0
index 411e3b57d16af..b7c49822ca888 100644
@@ -373,6 +373,7 @@ static const struct dsa_device_ops brcm_legacy_fcs_netdev_ops = {
 	.xmit = brcm_leg_fcs_tag_xmit,
 	.rcv = brcm_leg_tag_rcv,
 	.needed_headroom = BRCM_LEG_TAG_LEN,
+	.needed_tailroom = ETH_FCS_LEN,
 };
 
 DSA_TAG_DRIVER(brcm_legacy_fcs_netdev_ops);
Signature · 1 line
2.55.0
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 30 lines · Weiming Shi

The legacy FCS tagger calculates the CRC over skb->len bytes starting at skb->data. When a nonlinear skb reaches the tagger, this reads past the linear head into unrelated slab memory.

The tagger appends an Ethernet FCS but does not declare that tailroom. As a result, DSA leaves NETIF_F_SG and NETIF_F_FRAGLIST enabled on the user port, and nonlinear skbs can reach the CRC calculation.

Declare the required tailroom. DSA will then clear those features and the networking core will linearize skbs before the tagger runs.

A KASAN-enabled dsa_loop test using this tagger reports:

   BUG: KASAN: slab-out-of-bounds in crc32_le
   Read of size 1 at addr ffff8880397086c0 by task exp/135

   Call Trace:
    crc32_le (lib/crc/crc32-main.c:38)
    brcm_leg_fcs_tag_xmit (net/dsa/tag_brcm.c:343)
    dsa_user_xmit (net/dsa/user.c:942)
    dev_hard_start_xmit (net/core/dev.c:3937)
    __dev_queue_xmit (net/core/dev.c:4926)
    packet_sendmsg (net/packet/af_packet.c:3110)
    __sys_sendto (net/socket.c:2281)

   The buggy address belongs to the object at ffff888039708400
    which belongs to the cache skbuff_small_head of size 704
   The buggy address is located 0 bytes to the right of
    allocated 704-byte region [ffff888039708400, ffff8880397086c0)
Quoted 6 lines
Fixes ef07df397a62 ("net: dsa: tag_brcm: add support for legacy FCS tags")
Reported-by [email protected]
Assisted-by Claude:gpt-5
Signature · 1 line
Florian
#2 lore raw
In reply to Weiming Shi
This patch was applied to netdev/net.git (main) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (main)
by Jakub Kicinski <[email protected]>:

Quoted 9 lines · On Wed, 9 Sep 2026 00:50:47 +0800 you wrote:

The legacy FCS tagger calculates the CRC over skb->len bytes starting at skb->data. When a nonlinear skb reaches the tagger, this reads past the linear head into unrelated slab memory.

The tagger appends an Ethernet FCS but does not declare that tailroom. As a result, DSA leaves NETIF_F_SG and NETIF_F_FRAGLIST enabled on the user port, and nonlinear skbs can reach the CRC calculation.

[...]

Here is the summary with links:
- [net] net: dsa: tag_brcm: legacy FCS: request needed tailroom

    https://git.kernel.org/netdev/net/c/5be081b83abd

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html