mac80211: make sure hw_key exists before checking its flags
authorArik Nemtsov <arik@wizery.com>
Thu, 10 Nov 2011 07:35:13 +0000 (09:35 +0200)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 11 Nov 2011 17:32:51 +0000 (12:32 -0500)
Fixes a bug introduced in:

commit 077a9154898b374f20555adc3f620cccd02581d6
Author: Arik Nemtsov <arik@wizery.com>
Date:   Sun Oct 23 08:21:41 2011 +0200

Reported-by: Arend van Spriel <arend@broadcom.com>
Reported-by: Johannes Berg <johannes@sipsolutions.net>
Signed-off-by: Arik Nemtsov <arik@wizery.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/wpa.c

index 13efab5bf12aa00ce34fece5d8fa2734efdb1a0a..106e15a4649f1f24ba5335227c44b5a79817e2fb 100644 (file)
@@ -415,7 +415,8 @@ static int ccmp_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
        memmove(pos, pos + CCMP_HDR_LEN, hdrlen);
 
        /* the HW only needs room for the IV, but not the actual IV */
-       if (info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE)
+       if (info->control.hw_key &&
+           (info->control.hw_key->flags & IEEE80211_KEY_FLAG_PUT_IV_SPACE))
                return 0;
 
        hdr = (struct ieee80211_hdr *) pos;