All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] ath9k_htc: Restore skb headroom when returning skb to mac80211
@ 2013-08-16 19:39 ` Marc Kleine-Budde
  0 siblings, 0 replies; 8+ messages in thread
From: Marc Kleine-Budde @ 2013-08-16 19:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: linux, ath9k-devel, Helmut Schaa, Marc Kleine-Budde

From: Helmut Schaa <helmut.schaa@googlemail.com>

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.

Reported-by: Marc Kleine-Budde <mkl@blackshift.org>
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Tested-by: Marc Kleine-Budde <mkl@blackshift.org>
Signed-off-by: Marc Kleine-Budde <mkl@blackshift.org>
---
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(+)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index e602c95..c028df7 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -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);
 }
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [ath9k-devel] [PATCH v2] ath9k_htc: Restore skb headroom when returning skb to mac80211
@ 2013-08-16 19:39 ` Marc Kleine-Budde
  0 siblings, 0 replies; 8+ messages in thread
From: Marc Kleine-Budde @ 2013-08-16 19:39 UTC (permalink / raw)
  To: ath9k-devel

From: Helmut Schaa <helmut.schaa@googlemail.com>

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.

Reported-by: Marc Kleine-Budde <mkl@blackshift.org>
Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
Tested-by: Marc Kleine-Budde <mkl@blackshift.org>
Signed-off-by: Marc Kleine-Budde <mkl@blackshift.org>
---
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(+)

diff --git a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
index e602c95..c028df7 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -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);
 }
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] ath9k_htc: Restore skb headroom when returning skb to mac80211
  2013-08-16 19:39 ` [ath9k-devel] " Marc Kleine-Budde
@ 2013-08-20  9:01   ` Marc Kleine-Budde
  -1 siblings, 0 replies; 8+ messages in thread
From: Marc Kleine-Budde @ 2013-08-20  9:01 UTC (permalink / raw)
  To: Marc Kleine-Budde; +Cc: linux-wireless, linux, ath9k-devel, Helmut Schaa

[-- Attachment #1: Type: text/plain, Size: 1325 bytes --]

On 08/16/2013 09:39 PM, Marc Kleine-Budde wrote:
> From: Helmut Schaa <helmut.schaa@googlemail.com>
> 
> 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.
> 
> Reported-by: Marc Kleine-Budde <mkl@blackshift.org>
> Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
> Tested-by: Marc Kleine-Budde <mkl@blackshift.org>
> Signed-off-by: Marc Kleine-Budde <mkl@blackshift.org>
> ---
> 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?

ping

Marc


[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 897 bytes --]

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [ath9k-devel] [PATCH v2] ath9k_htc: Restore skb headroom when returning skb to mac80211
@ 2013-08-20  9:01   ` Marc Kleine-Budde
  0 siblings, 0 replies; 8+ messages in thread
From: Marc Kleine-Budde @ 2013-08-20  9:01 UTC (permalink / raw)
  To: ath9k-devel

On 08/16/2013 09:39 PM, Marc Kleine-Budde wrote:
> From: Helmut Schaa <helmut.schaa@googlemail.com>
> 
> 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.
> 
> Reported-by: Marc Kleine-Budde <mkl@blackshift.org>
> Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
> Tested-by: Marc Kleine-Budde <mkl@blackshift.org>
> Signed-off-by: Marc Kleine-Budde <mkl@blackshift.org>
> ---
> 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?

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 

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] ath9k_htc: Restore skb headroom when returning skb to mac80211
  2013-08-20  9:01   ` [ath9k-devel] " Marc Kleine-Budde
@ 2013-08-20 12:57     ` Helmut Schaa
  -1 siblings, 0 replies; 8+ messages in thread
From: Helmut Schaa @ 2013-08-20 12:57 UTC (permalink / raw)
  To: Marc Kleine-Budde, John Linville
  Cc: Marc Kleine-Budde, linux-wireless, Oleksij Rempel, ath9k-devel

Hi John, Hi Marc,

On Tue, Aug 20, 2013 at 11:01 AM, Marc Kleine-Budde <mkl@blackshift.org> wrote:
> On 08/16/2013 09:39 PM, Marc Kleine-Budde wrote:
>> From: Helmut Schaa <helmut.schaa@googlemail.com>
>>
>> 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.
>>
>> Reported-by: Marc Kleine-Budde <mkl@blackshift.org>
>> Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
>> Tested-by: Marc Kleine-Budde <mkl@blackshift.org>
>> Signed-off-by: Marc Kleine-Budde <mkl@blackshift.org>
>> ---
>> 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?
>
> ping

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

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

Thanks,
Helmut

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [ath9k-devel] [PATCH v2] ath9k_htc: Restore skb headroom when returning skb to mac80211
@ 2013-08-20 12:57     ` Helmut Schaa
  0 siblings, 0 replies; 8+ messages in thread
From: Helmut Schaa @ 2013-08-20 12:57 UTC (permalink / raw)
  To: ath9k-devel

Hi John, Hi Marc,

On Tue, Aug 20, 2013 at 11:01 AM, Marc Kleine-Budde <mkl@blackshift.org> wrote:
> On 08/16/2013 09:39 PM, Marc Kleine-Budde wrote:
>> From: Helmut Schaa <helmut.schaa@googlemail.com>
>>
>> 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.
>>
>> Reported-by: Marc Kleine-Budde <mkl@blackshift.org>
>> Signed-off-by: Helmut Schaa <helmut.schaa@googlemail.com>
>> Tested-by: Marc Kleine-Budde <mkl@blackshift.org>
>> Signed-off-by: Marc Kleine-Budde <mkl@blackshift.org>
>> ---
>> 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?
>
> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH v2] ath9k_htc: Restore skb headroom when returning skb to mac80211
  2013-08-16 19:39 ` [ath9k-devel] " Marc Kleine-Budde
@ 2013-08-20 12:59   ` Helmut Schaa
  -1 siblings, 0 replies; 8+ messages in thread
From: Helmut Schaa @ 2013-08-20 12:59 UTC (permalink / raw)
  To: Marc Kleine-Budde
  Cc: linux-wireless, Oleksij Rempel, ath9k-devel, Marc Kleine-Budde

On Fri, Aug 16, 2013 at 9:39 PM, Marc Kleine-Budde <mkl@pengutronix.de> wrote:
> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [ath9k-devel] [PATCH v2] ath9k_htc: Restore skb headroom when returning skb to mac80211
@ 2013-08-20 12:59   ` Helmut Schaa
  0 siblings, 0 replies; 8+ messages in thread
From: Helmut Schaa @ 2013-08-20 12:59 UTC (permalink / raw)
  To: ath9k-devel

On Fri, Aug 16, 2013 at 9:39 PM, Marc Kleine-Budde <mkl@pengutronix.de> wrote:
> 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

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2013-08-20 12:59 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-08-16 19:39 [PATCH v2] ath9k_htc: Restore skb headroom when returning skb to mac80211 Marc Kleine-Budde
2013-08-16 19:39 ` [ath9k-devel] " Marc Kleine-Budde
2013-08-20  9:01 ` Marc Kleine-Budde
2013-08-20  9:01   ` [ath9k-devel] " Marc Kleine-Budde
2013-08-20 12:57   ` Helmut Schaa
2013-08-20 12:57     ` [ath9k-devel] " Helmut Schaa
2013-08-20 12:59 ` Helmut Schaa
2013-08-20 12:59   ` [ath9k-devel] " Helmut Schaa

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.