* [PATCH ath-current] wifi: ath10k: Do not free the caller's skb when HL TX expands the headroom
@ 2026-11-19 5:57 Yuqiang Sun
0 siblings, 0 replies; only message in thread
From: Yuqiang Sun @ 2026-11-19 5:57 UTC (permalink / raw)
To: jjohnson; +Cc: lcy8047, linux-wireless, ath10k, linux-kernel, stable
When the skb has too little headroom, ath10k_htt_tx_hl() copies it with
skb_realloc_headroom() and frees the original. If the copy fails, or a
later step fails, the function returns an error and
ath10k_mac_tx_submit() frees the original skb again with
ieee80211_free_txskb().
Expand the headroom of the same skb with pskb_expand_head() instead, so
the caller still owns it on every error path.
Fixes: a2097d6444c3 ("ath10k: htt: High latency TX support")
Cc: stable@vger.kernel.org
Signed-off-by: Yuqiang Sun <izaiahsun@gmail.com>
---
Notes:
Bug was found by kbound, an internal static analysis prototype.
The fix was written with the help of Claude Opus 5.5.
Compile-tested only (x86_64 and arm64 allmodconfig, W=1, sparse): I do
not have an SDIO or USB ath10k device.
drivers/net/wireless/ath/ath10k/htt_tx.c | 11 ++++-------
1 file changed, 4 insertions(+), 7 deletions(-)
diff --git a/drivers/net/wireless/ath/ath10k/htt_tx.c b/drivers/net/wireless/ath/ath10k/htt_tx.c
index efaea150025b..7b759f506f80 100644
--- a/drivers/net/wireless/ath/ath10k/htt_tx.c
+++ b/drivers/net/wireless/ath/ath10k/htt_tx.c
@@ -1276,7 +1276,6 @@ static int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txm
struct htt_cmd_hdr *cmd_hdr;
struct htt_data_tx_desc *tx_desc;
struct ath10k_skb_cb *skb_cb = ATH10K_SKB_CB(msdu);
- struct sk_buff *tmp_skb;
bool is_eth = (txmode == ATH10K_HW_TXRX_ETHERNET);
u8 vdev_id = ath10k_htt_tx_get_vdev_id(ar, msdu);
u8 tid = ath10k_htt_tx_get_tid(msdu, is_eth);
@@ -1330,16 +1329,14 @@ static int ath10k_htt_tx_hl(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txm
* and realloc the skb if it does not have enough headroom.
*/
if (skb_headroom(msdu) < HTT_TX_HL_NEEDED_HEADROOM) {
- tmp_skb = msdu;
-
ath10k_dbg(htt->ar, ATH10K_DBG_HTT,
"Not enough headroom in skb. Current headroom: %u, needed: %u. Reallocating...\n",
skb_headroom(msdu), HTT_TX_HL_NEEDED_HEADROOM);
- msdu = skb_realloc_headroom(msdu, HTT_TX_HL_NEEDED_HEADROOM);
- kfree_skb(tmp_skb);
- if (!msdu) {
+ res = pskb_expand_head(msdu,
+ HTT_TX_HL_NEEDED_HEADROOM - skb_headroom(msdu),
+ 0, GFP_ATOMIC);
+ if (res) {
ath10k_warn(htt->ar, "htt hl tx: Unable to realloc skb!\n");
- res = -ENOMEM;
goto out;
}
}
base-commit: b1ed5a45b994a6473ca1cf34f35a1bf87f1d8e2a
--
2.53.0
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-11-19 5:57 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-19 5:57 [PATCH ath-current] wifi: ath10k: Do not free the caller's skb when HL TX expands the headroom Yuqiang Sun
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®