Skip to contentSkip to conversation

ath9k_htc: Restore skb headroom when returning skb to mac80211

PATCH New Marc Kleine-Budde 3 participants 4 messages Aug 16, 2013 – Aug 20, 2013 Qualcomm Atheros ATH9K wireless driver

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 ath9k_htc: Restore skb headroom when returning skb to mac80211

From: Helmut Schaa <[email protected]>

ath9k_htc adds padding between the 802.11 header and the payload during TX by moving the header. When handing the frame back to mac80211 for TX status handling the header is not moved back into its original position. This can result in a too small skb headroom when entering ath9k_htc again (due to a soft retransmission for example) causing an skb_under_panic oops.

Fix this by moving the 802.11 header back into its original position before returning the frame to mac80211 as other drivers like rt2x00 or ath5k do.

---
Hello Helmut,

I've change the patch a bit, I've used ieee80211_get_hdrlen_from_skb() instead of open coding it.

Tested in ARMv5 with USB device
"ID 0cf3:7015 Atheros Communications, Inc. TP-Link TL-WN821N v3 802.11n [Atheros AR7010+AR9287]"
for four weeks. Without that patch the kernel oopes after about one week.

I think this is a candidate for stable, can you add stable to Cc?

regards,
Marc

changes since v1:
- use ieee80211_get_hdrlen_from_skb() instead of open coding it

 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
drivers/net/wireless/ath/ath9k/htc_drv_txrx.c +10 -0
index e602c95..c028df7 100644
@@ -448,6 +448,7 @@ static void ath9k_htc_tx_process(struct ath9k_htc_priv *priv,
 	struct ieee80211_conf *cur_conf = &priv->hw->conf;
 	bool txok;
 	int slot;
+	int hdrlen, padsize;
 
 	slot = strip_drv_header(priv, skb);
 	if (slot < 0) {
@@ -504,6 +505,15 @@ send_mac80211:
 
 	ath9k_htc_tx_clear_slot(priv, slot);
 
+	/* Remove padding before handing frame back to mac80211 */
+	hdrlen = ieee80211_get_hdrlen_from_skb(skb);
+
+	padsize = hdrlen & 3;
+	if (padsize && skb->len > hdrlen + padsize) {
+		memmove(skb->data + padsize, skb->data, hdrlen);
+		skb_pull(skb, padsize);
+	}
+
 	/* Send status to mac80211 */
 	ieee80211_tx_status(priv->hw, skb);
 }
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH v2 1/1 ath9k_htc: Restore skb headroom when returning skb to mac80211

Quoted 20 lines · Marc Kleine-Budde

From: Helmut Schaa <[email protected]>

ath9k_htc adds padding between the 802.11 header and the payload during TX by moving the header. When handing the frame back to mac80211 for TX status handling the header is not moved back into its original position. This can result in a too small skb headroom when entering ath9k_htc again (due to a soft retransmission for example) causing an skb_under_panic oops.

Fix this by moving the 802.11 header back into its original position before returning the frame to mac80211 as other drivers like rt2x00 or ath5k do.

---
Hello Helmut,

Quoted 8 lines

I've change the patch a bit, I've used ieee80211_get_hdrlen_from_skb() instead of open coding it.

Tested in ARMv5 with USB device
"ID 0cf3:7015 Atheros Communications, Inc. TP-Link TL-WN821N v3 802.11n [Atheros AR7010+AR9287]"
for four weeks. Without that patch the kernel oopes after about one week.

I think this is a candidate for stable, can you add stable to Cc?

ping

Marc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 897 bytes
Desc: OpenPGP digital signature
Url : http://lists.ath9k.org/pipermail/ath9k-devel/attachments/20130820/169cba71/attachment.pgp

#2 lore raw

PATCH v2 1/1 ath9k_htc: Restore skb headroom when returning skb to mac80211

Hi John, Hi Marc,

Quoted 24 lines · Marc Kleine-Budde
Quoted 23 lines · Marc Kleine-Budde

From: Helmut Schaa <[email protected]>

ath9k_htc adds padding between the 802.11 header and the payload during TX by moving the header. When handing the frame back to mac80211 for TX status handling the header is not moved back into its original position. This can result in a too small skb headroom when entering ath9k_htc again (due to a soft retransmission for example) causing an skb_under_panic oops.

Fix this by moving the 802.11 header back into its original position before returning the frame to mac80211 as other drivers like rt2x00 or ath5k do.

---
Hello Helmut,

I've change the patch a bit, I've used ieee80211_get_hdrlen_from_skb() instead of open coding it.

Quoted 7 lines
Quoted 5 lines

Tested in ARMv5 with USB device
"ID 0cf3:7015 Atheros Communications, Inc. TP-Link TL-WN821N v3 802.11n [Atheros AR7010+AR9287]"
for four weeks. Without that patch the kernel oopes after about one week.

I think this is a candidate for stable, can you add stable to Cc?

ping

Sorry, completely forgot about this patch. You're right, this is indeed a stable candidate.

John, could you please add "Cc: stable at vger.kernel.org" when applying this to your tree?

Thanks,
Helmut

#3 lore raw

PATCH v2 1/1 ath9k_htc: Restore skb headroom when returning skb to mac80211

In reply to Marc Kleine-Budde
Quoted 3 lines · Marc Kleine-Budde

Tested in ARMv5 with USB device
"ID 0cf3:7015 Atheros Communications, Inc. TP-Link TL-WN821N v3 802.11n [Atheros AR7010+AR9287]"
for four weeks. Without that patch the kernel oopes after about one week.

Thanks for testing by the way!
Helmut