[PATCH wireless] wifi: mac80211: Avoid out-of-bounds read in ieee80211_rx_mesh_data()
From: Hu Xinyao
Date: Mon Nov 30 2026 - 00:00:35 EST
ieee80211_rx_mesh_data() only pulls sizeof(*eth) + mesh_hdrlen bytes on
entry, allowing forwarded mesh data frames with fewer than 8 payload
bytes.
After pushing the 802.11 header onto the linearized fwd_skb and adding
mesh_hdrlen to hdrlen, ieee80211_get_8023_tunnel_proto() reads 8 bytes
at fwd_skb->data + hdrlen without checking the remaining frame length,
reading past fwd_skb->tail when the payload is shorter than 8 bytes
(unlike ieee80211_strip_8023_mesh_hdr(), which checks hdrlen + 8).
Check skb_headlen(fwd_skb) >= hdrlen + 8 before calling
ieee80211_get_8023_tunnel_proto().
Found during a GLM-5.4-assisted code audit and verified manually against
mainline; compile-tested only (not triggered at runtime).
Fixes: 986e43b19ae9 ("wifi: mac80211: fix receiving A-MSDU frames on mesh interfaces")
Cc: stable@xxxxxxxxxxxxxxx
Signed-off-by: Hu Xinyao <huxinyao@xxxxxxxxxxxxxxx>
---
net/mac80211/rx.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 64352e4..f4bb98b 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -2925,7 +2925,8 @@ ieee80211_rx_mesh_data(struct ieee80211_sub_if_data *sdata, struct sta_info *sta
skb_reset_mac_header(fwd_skb);
hdrlen += mesh_hdrlen;
- if (ieee80211_get_8023_tunnel_proto(fwd_skb->data + hdrlen,
+ if (skb_headlen(fwd_skb) >= hdrlen + 8 &&
+ ieee80211_get_8023_tunnel_proto(fwd_skb->data + hdrlen,
&fwd_skb->protocol))
hdrlen += ETH_ALEN;
else
--
2.43.0