Search Linux Wireless

Re: [PATCH] ath9k_htc: fix skb_under_panic error

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jun 4, 2013 at 8:37 PM, Oleksij Rempel <linux@xxxxxxxxxxxxxxxx> wrote:
> This error seems to be really rare, and we do not know real couse of it.
> But, in any case, we should check size of head before reducing it.

Mind to try the (completely untested) patch against wireless-testing instead?
Helmut

---
Subject: [PATCH] ath9k_htc: Restore skb headroom when returning skb to mac80211

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.

Signed-off-by: Helmut Schaa <helmut.schaa@xxxxxxxxxxxxxx>
---
 drivers/net/wireless/ath/ath9k/htc_drv_txrx.c |   11 +++++++++++
 1 file changed, 11 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..666cfb6 100644
--- a/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
+++ b/drivers/net/wireless/ath/ath9k/htc_drv_txrx.c
@@ -448,6 +448,8 @@ static void ath9k_htc_tx_process(struct
ath9k_htc_priv *priv,
     struct ieee80211_conf *cur_conf = &priv->hw->conf;
     bool txok;
     int slot;
+    struct ieee80211_hdr *hdr;
+    int padpos, padsize;

     slot = strip_drv_header(priv, skb);
     if (slot < 0) {
@@ -504,6 +506,15 @@ send_mac80211:

     ath9k_htc_tx_clear_slot(priv, slot);

+    /* Remove padding before handing frame back to mac80211 */
+    hdr = (struct ieee80211_hdr *) skb->data;
+    padpos = ieee80211_hdrlen(hdr->frame_control);
+    padsize = padpos & 3;
+    if (padsize && skb->len > padpos + padsize) {
+        memmove(skb->data + padsize, skb->data, padpos);
+        skb_pull(skb, padsize);
+    }
+
     /* Send status to mac80211 */
     ieee80211_tx_status(priv->hw, skb);
 }
--
1.7.10.4
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Host AP]     [ATH6KL]     [Linux Wireless Personal Area Network]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Linux Kernel]     [IDE]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Hiking]     [MIPS Linux]     [ARM Linux]     [Linux RAID]

  Powered by Linux