* [PATCH] mac80211: fix missing crypto tailroom in fast-xmit
@ 2026-11-24 9:20 Filip Balluch
0 siblings, 0 replies; only message in thread
From: Filip Balluch @ 2026-11-24 9:20 UTC (permalink / raw)
To: johannes; +Cc: linux-wireless, linux-kernel, jtornosm, Filip Balluch
A key uploaded to hardware with the IEEE80211_KEY_FLAG_RESERVE_TAILROOM
flag set tells mac80211 that the driver will handle the encryption
itself but needs MIC tailroom reserved in the skb. The regular TX path
honors this through crypto_tx_tailroom_needed_cnt in
ieee80211_skb_resize(), but the fast-xmit path always passes ENCRYPT_NO
and never reserves tailroom for such keys.
mac80211_hwsim claims CCMP/GCMP keys as hardware keys while encrypting
in software at TX time, so with full-MSS TCP segments the CCMP code
finds an skb without the required tailroom.
dmesg logs:
WARNING: CPU: 0 PID: 0 at net/mac80211/wpa.c:462 ccmp_encrypt_skb.isra.0+0x73/0x1f0 [mac80211]
RIP: 0010:ccmp_encrypt_skb.isra.0+0x73/0x1f0 [mac80211]
Call Trace:
<IRQ>
ieee80211_crypto_ccmp_encrypt+0x3c/0x60 [mac80211]
ieee80211_encrypt_tx_skb+0x91/0x110 [mac80211]
mac80211_hwsim_tx+0x1cc/0x7f0 [mac80211_hwsim]
ieee80211_handle_wake_tx_queue+0x74/0xc0 [mac80211]
ieee80211_queue_skb+0x204/0x430 [mac80211]
__ieee80211_xmit_fast+0x206/0x3b0 [mac80211]
and the frame is dropped. The same combination of fast-xmit and a
RESERVE_TAILROOM key is reachable on ath11k and ath12k in raw mode,
where the firmware expects the reserved MIC space to be present.
Pass ENCRYPT_DATA instead so that tailroom is reserved whenever a
driver requested it. For drivers without any RESERVE_TAILROOM keys the
counter is zero and the resize behaves exactly as before.
Fixes: 17c18bf880b2 ("mac80211: add TX fastpath")
Signed-off-by: Filip Balluch <fballuch@redhat.com>
---
net/mac80211/tx.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 91b14112e24f..760da3114956 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -3753,14 +3753,14 @@ void __ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
ieee80211_amsdu_aggregate(sdata, sta, fast_tx, skb, da, sa))
return;
- /* will not be crypto-handled beyond what we do here, so use false
- * as the may-encrypt argument for the resize to not account for
- * more room than we already have in 'extra_head'
+ /* the key may require tailroom to be reserved, e.g. when the
+ * driver encrypts in software (IEEE80211_KEY_FLAG_RESERVE_TAILROOM),
+ * so ask for encryption tailroom even though we don't encrypt here
*/
if (unlikely(ieee80211_skb_resize(sdata, skb,
max_t(int, extra_head + hw_headroom -
skb_headroom(skb), 0),
- ENCRYPT_NO)))
+ ENCRYPT_DATA)))
goto free;
hdr = skb_push(skb, extra_head);
--
2.56.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-24 9:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-24 9:20 [PATCH] mac80211: fix missing crypto tailroom in fast-xmit Filip Balluch
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®