* [PATCH ath-next] wifi: ath10k: free msdu_id and skb reference when HL TX fails
@ 2026-11-18 5:21 Changyul Lee
2026-11-18 8:53 ` Loic Poulain
0 siblings, 1 reply; 2+ messages in thread
From: Changyul Lee @ 2026-11-18 5:21 UTC (permalink / raw)
To: Jeff Johnson, Loic Poulain
Cc: Wentao Liang, linux-wireless, ath10k, linux-kernel, Changyul Lee
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@gmail.com>
---
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
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: [PATCH ath-next] wifi: ath10k: free msdu_id and skb reference when HL TX fails
2026-11-18 5:21 [PATCH ath-next] wifi: ath10k: free msdu_id and skb reference when HL TX fails Changyul Lee
@ 2026-11-18 8:53 ` Loic Poulain
0 siblings, 0 replies; 2+ messages in thread
From: Loic Poulain @ 2026-11-18 8:53 UTC (permalink / raw)
To: Changyul Lee
Cc: Jeff Johnson, Wentao Liang, linux-wireless, ath10k, linux-kernel
On Wed, Nov 18, 2026 at 6:21 AM Changyul Lee <lcy8047@gmail.com> wrote:
>
> 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.
The above message looks too verbose and confusing for a somewhat
simple issue. Maybe this should be split properly in two fixes.
> 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")
If this is a fix you should not target 'ath-next'.
Two fixes tag looks weird, what are you fixin exactly?
> Signed-off-by: Changyul Lee <lcy8047@gmail.com>
> ---
> 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
>
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2026-11-18 8:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-18 5:21 [PATCH ath-next] wifi: ath10k: free msdu_id and skb reference when HL TX fails Changyul Lee
2026-11-18 8:53 ` Loic Poulain
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®