From: Yuqiang Sun <izaiahsun@gmail.com>
To: jjohnson@kernel.org
Cc: lcy8047@gmail.com, linux-wireless@vger.kernel.org,
ath10k@lists.infradead.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: [PATCH ath-current] wifi: ath10k: Do not free the caller's skb when HL TX expands the headroom
Date: Thu, 19 Nov 2026 13:57:40 +0800 [thread overview]
Message-ID: <20261119055740.55934-1-izaiahsun@gmail.com> (raw)
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
reply other threads:[~2026-11-19 5:57 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261119055740.55934-1-izaiahsun@gmail.com \
--to=izaiahsun@gmail.com \
--cc=ath10k@lists.infradead.org \
--cc=jjohnson@kernel.org \
--cc=lcy8047@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox