mac80211: backport ath9k wep fix from r22046
[openwrt-10.03/.git] / package / mac80211 / patches / 550-ath9k_fix_wep_adhoc_crash.patch
1 --- a/drivers/net/wireless/ath/ath9k/common.c
2 +++ b/drivers/net/wireless/ath/ath9k/common.c
3 @@ -319,6 +319,10 @@ int ath9k_cmn_key_config(struct ath_comm
4                         idx = ath_reserve_key_cache_slot(common, key->alg);
5                         break;
6                 case NL80211_IFTYPE_ADHOC:
7 +                       if (!sta) {
8 +                               idx = key->keyidx;
9 +                               break;
10 +                       }
11                         memcpy(gmac, sta->addr, ETH_ALEN);
12                         gmac[0] |= 0x01;
13                         mac = gmac;