From: Johannes Berg For injection we only check the header is in the skb head, but e.g. ACK/CTS are really short, and we then try to use A2 anyway. Require A1 (no S1G extension frames) and use A2 only when present. Assisted-by: LLM Signed-off-by: Johannes Berg --- net/mac80211/tx.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 34f3a4ac7278..27294466958d 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2471,7 +2471,9 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, hdr = (struct ieee80211_hdr *)(skb->data + len_rthdr); hdrlen = ieee80211_hdrlen(hdr->frame_control); - if (skb_headlen(skb) < len_rthdr + hdrlen) + if (skb_headlen(skb) < len_rthdr + + max_t(int, hdrlen, + offsetofend(struct ieee80211_hdr, addr1))) goto fail; /* @@ -2505,7 +2507,8 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, if (tmp_sdata->vif.type == NL80211_IFTYPE_MONITOR || tmp_sdata->vif.type == NL80211_IFTYPE_AP_VLAN) continue; - if (ether_addr_equal(tmp_sdata->vif.addr, hdr->addr2)) { + if (hdrlen >= offsetofend(struct ieee80211_hdr, addr2) && + ether_addr_equal(tmp_sdata->vif.addr, hdr->addr2)) { sdata = tmp_sdata; break; } -- 2.55.0