mac80211: avoid NULL ptr deref when using WEP
authorJohn W. Linville <linville@tuxdriver.com>
Fri, 22 Jan 2010 17:33:09 +0000 (12:33 -0500)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 22 Jan 2010 17:39:14 +0000 (12:39 -0500)
"mac80211: move control.hw_key assignment" changed an if-else into two
separate if statments, but the if-else is needed to prevent
dereferencing a null info->control.hw_key.  This fixes avoids a lock-up
during association on my machine when using WEP.

Signed-off-by: John W. Linville <linville@tuxdriver.com>
net/mac80211/wep.c

index 0a4c641c960537c8a93ec3190927c3f484969490..5d745f2d72364fcc8289cd104856c2150d7ec61d 100644 (file)
@@ -310,9 +310,8 @@ static int wep_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
                                          tx->key->conf.keylen,
                                          tx->key->conf.keyidx))
                        return -1;
-       }
-
-       if (info->control.hw_key->flags & IEEE80211_KEY_FLAG_GENERATE_IV) {
+       } else if (info->control.hw_key->flags &
+                       IEEE80211_KEY_FLAG_GENERATE_IV) {
                if (!ieee80211_wep_add_iv(tx->local, skb,
                                          tx->key->conf.keylen,
                                          tx->key->conf.keyidx))