[PATCH ath-next] wifi: ath10k: free msdu_id and skb reference when HL TX fails

From: Changyul Lee

Date: Wed Nov 18 2026 - 00:21:34 EST


For SDIO and USB devices, ath10k_htt_tx_hl() allocates an msdu_id in
htt->pending_tx and takes an extra skb reference that
ath10k_htt_htc_tx_complete() normally drops. If ath10k_htc_send_hl()
fails, for example because the endpoint has no TX credits and TX
bundling is off, no completion runs and both are leaked. After
max_num_pending_tx such failures, msdu_id allocation fails and no more
data frames can be sent.

Free the msdu_id under tx_lock, as ath10k_htt_tx_32() does on its error
path, and drop the extra skb reference.

Fixes: 8ea51e409eb0 ("ath10k: htt: support MSDU ids with SDIO")
Fixes: 30382dd1cf3a ("ath10k: fix use-after-free on SDIO data frames")
Signed-off-by: Changyul Lee <lcy8047@xxxxxxxxx>
---
Found with a static analysis tool we are developing.

Compile-tested only, with x86_64_defconfig plus ATH10K_SDIO, ATH10K_USB
and W=1.

drivers/net/wireless/ath/ath10k/htt_tx.c | 8 ++++++++
1 file changed, 8 insertions(+)

diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
index efaea150025b..b437b09717e1 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -1378,6 +1378,14 @@ static int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txm
tx_desc->peerid = __cpu_to_le32(HTT_INVALID_PEERID);

res = ath10k_htc_send_hl(&htt->ar->htc, htt->eid, msdu);
+ if (res) {
+ if (ar->bus_param.hl_msdu_ids) {
+ spin_lock_bh(&htt->tx_lock);
+ ath10k_htt_tx_free_msdu_id(htt, msdu_id);
+ spin_unlock_bh(&htt->tx_lock);
+ }
+ dev_kfree_skb_any(msdu);
+ }

out:
return res;

base-commit: 4016f6c3149e7e3faccc1654db6a3030c069383a
--
2.43.0