]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
ath5k: explicitly check skb->len
authorHarvey Harrison <harvey.harrison@gmail.com>
Wed, 16 Jul 2008 01:44:02 +0000 (18:44 -0700)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 22 Aug 2008 20:29:53 +0000 (16:29 -0400)
ieee80211_get_hdrlen_from_skb internally checks that the skb is long
enough to hold the full header, or it returns 0 if not.  The check in
ath5k does not check this case and assumes it always got the actual
header length which it then checks against the skb->len plus some headroom.

Change to ieee80211_hdrlen which always returns the hdrlen and keep the
existing headroom check.

Signed-off-by: Harvey Harrison <harvey.harrison@gmail.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
drivers/net/wireless/ath5k/base.c

index 114520258b78f5d4948a8c933cdf26b1396bc5c1..c1de1ef09e59bfa812620215bd702118dcaa7483 100644 (file)
@@ -1540,7 +1540,7 @@ ath5k_rx_decrypted(struct ath5k_softc *sc, struct ath5k_desc *ds,
                struct sk_buff *skb, struct ath5k_rx_status *rs)
 {
        struct ieee80211_hdr *hdr = (void *)skb->data;
-       unsigned int keyix, hlen = ieee80211_get_hdrlen_from_skb(skb);
+       unsigned int keyix, hlen;
 
        if (!(rs->rs_status & AR5K_RXERR_DECRYPT) &&
                        rs->rs_keyix != AR5K_RXKEYIX_INVALID)
@@ -1549,6 +1549,7 @@ ath5k_rx_decrypted(struct ath5k_softc *sc, struct ath5k_desc *ds,
        /* Apparently when a default key is used to decrypt the packet
           the hw does not set the index used to decrypt.  In such cases
           get the index from the packet. */
+       hlen = ieee80211_hdrlen(hdr->frame_control);
        if (ieee80211_has_protected(hdr->frame_control) &&
            !(rs->rs_status & AR5K_RXERR_DECRYPT) &&
            skb->len >= hlen + 4) {