Thread (3 messages) 3 messages, 2 authors, 7d ago
COOLING7d

Revision v1 of 2 in this series.

Revisions (2)
  1. v1 current
  2. v2 [diff vs current]

[PATCH net 1/1] llc: reserve device headroom for allocated frames

From: Ren Wei <hidden>
Date: 2026-09-22 09:42:32
Subsystem: llc (802.2), networking [general], the rest · Maintainers: "David S. Miller", Eric Dumazet, Jakub Kicinski, Paolo Abeni, Linus Torvalds

From: Zixuan Chai <redacted>

llc_alloc_frame() reserves link-layer headroom using the device type.
This is insufficient for stacked Ethernet devices such as VLAN devices,
where vlan_dev_hard_header() pushes a VLAN header before the lower
device's Ethernet header. An LLC response on such a device can
therefore underflow skb headroom in eth_header().

Use LL_RESERVED_SPACE() to account for the device's actual required
headroom while preserving the existing reservation for the LLC header.

Fixes: bf9ae5386bca ("llc: use dev_hard_header")
Cc: stable@vger.kernel.org
Reported-by: VEGA <redacted>
Assisted-by: LLM
Signed-off-by: Zixuan Chai <redacted>
Signed-off-by: Ren Wei <redacted>
---
 net/llc/llc_sap.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/net/llc/llc_sap.c b/net/llc/llc_sap.c
index 1bd446a21092..4b203ffb1e83 100644
--- a/net/llc/llc_sap.c
+++ b/net/llc/llc_sap.c
@@ -19,16 +19,6 @@
 #include <linux/llc.h>
 #include <linux/slab.h>
 
-static int llc_mac_header_len(unsigned short devtype)
-{
-	switch (devtype) {
-	case ARPHRD_ETHER:
-	case ARPHRD_LOOPBACK:
-		return sizeof(struct ethhdr);
-	}
-	return 0;
-}
-
 /**
  *	llc_alloc_frame - allocates sk_buff for frame
  *	@sk:  socket to allocate frame to
@@ -45,7 +35,7 @@ struct sk_buff *llc_alloc_frame(struct sock *sk, struct net_device *dev,
 	int hlen = type == LLC_PDU_TYPE_U ? 3 : 4;
 	struct sk_buff *skb;
 
-	hlen += llc_mac_header_len(dev->type);
+	hlen += LL_RESERVED_SPACE(dev);
 	skb = alloc_skb(hlen + data_size, GFP_ATOMIC);
 
 	if (skb) {
-- 
2.34.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help