diff options
-rw-r--r-- | drivers/net/wireless/ath9k/recv.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/net/wireless/ath9k/recv.c b/drivers/net/wireless/ath9k/recv.c index cb449f0b4171..f2327d8e9c28 100644 --- a/drivers/net/wireless/ath9k/recv.c +++ b/drivers/net/wireless/ath9k/recv.c | |||
@@ -571,8 +571,16 @@ int ath_rx_tasklet(struct ath_softc *sc, int flush) | |||
571 | hdr = (struct ieee80211_hdr *)skb->data; | 571 | hdr = (struct ieee80211_hdr *)skb->data; |
572 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); | 572 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); |
573 | 573 | ||
574 | if (hdrlen & 3) { | 574 | /* The MAC header is padded to have 32-bit boundary if the |
575 | padsize = hdrlen % 4; | 575 | * packet payload is non-zero. The general calculation for |
576 | * padsize would take into account odd header lengths: | ||
577 | * padsize = (4 - hdrlen % 4) % 4; However, since only | ||
578 | * even-length headers are used, padding can only be 0 or 2 | ||
579 | * bytes and we can optimize this a bit. In addition, we must | ||
580 | * not try to remove padding from short control frames that do | ||
581 | * not have payload. */ | ||
582 | padsize = hdrlen & 3; | ||
583 | if (padsize && hdrlen >= 24) { | ||
576 | memmove(skb->data + padsize, skb->data, hdrlen); | 584 | memmove(skb->data + padsize, skb->data, hdrlen); |
577 | skb_pull(skb, padsize); | 585 | skb_pull(skb, padsize); |
578 | } | 586 | } |