aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
Diffstat (limited to 'net')
-rw-r--r--net/mac80211/cfg.c5
-rw-r--r--net/mac80211/main.c5
-rw-r--r--net/mac80211/rc80211_minstrel_ht.c6
-rw-r--r--net/mac80211/tkip.c8
-rw-r--r--net/mac80211/tkip.h2
-rw-r--r--net/mac80211/wep.c24
-rw-r--r--net/mac80211/wep.h2
-rw-r--r--net/mac80211/wpa.c5
-rw-r--r--net/wireless/mlme.c8
-rw-r--r--net/wireless/nl80211.c2
10 files changed, 39 insertions, 28 deletions
diff --git a/net/mac80211/cfg.c b/net/mac80211/cfg.c
index 9eb02a34088..5e56e91c92c 100644
--- a/net/mac80211/cfg.c
+++ b/net/mac80211/cfg.c
@@ -143,6 +143,11 @@ static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev,
143 return -EINVAL; 143 return -EINVAL;
144 } 144 }
145 145
146 /* reject WEP and TKIP keys if WEP failed to initialize */
147 if ((alg == ALG_WEP || alg == ALG_TKIP) &&
148 IS_ERR(sdata->local->wep_tx_tfm))
149 return -EINVAL;
150
146 key = ieee80211_key_alloc(alg, key_idx, params->key_len, params->key, 151 key = ieee80211_key_alloc(alg, key_idx, params->key_len, params->key,
147 params->seq_len, params->seq); 152 params->seq_len, params->seq);
148 if (!key) 153 if (!key)
diff --git a/net/mac80211/main.c b/net/mac80211/main.c
index edf7aff9326..0e95c750ded 100644
--- a/net/mac80211/main.c
+++ b/net/mac80211/main.c
@@ -637,11 +637,9 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
637 goto fail_sta_info; 637 goto fail_sta_info;
638 638
639 result = ieee80211_wep_init(local); 639 result = ieee80211_wep_init(local);
640 if (result < 0) { 640 if (result < 0)
641 printk(KERN_DEBUG "%s: Failed to initialize wep: %d\n", 641 printk(KERN_DEBUG "%s: Failed to initialize wep: %d\n",
642 wiphy_name(local->hw.wiphy), result); 642 wiphy_name(local->hw.wiphy), result);
643 goto fail_wep;
644 }
645 643
646 rtnl_lock(); 644 rtnl_lock();
647 645
@@ -694,7 +692,6 @@ int ieee80211_register_hw(struct ieee80211_hw *hw)
694 fail_rate: 692 fail_rate:
695 rtnl_unlock(); 693 rtnl_unlock();
696 ieee80211_wep_free(local); 694 ieee80211_wep_free(local);
697 fail_wep:
698 sta_info_stop(local); 695 sta_info_stop(local);
699 fail_sta_info: 696 fail_sta_info:
700 destroy_workqueue(local->workqueue); 697 destroy_workqueue(local->workqueue);
diff --git a/net/mac80211/rc80211_minstrel_ht.c b/net/mac80211/rc80211_minstrel_ht.c
index 52c85036660..b5ace243546 100644
--- a/net/mac80211/rc80211_minstrel_ht.c
+++ b/net/mac80211/rc80211_minstrel_ht.c
@@ -240,6 +240,7 @@ minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
240 MINSTREL_FRAC(3, 4)) || mr->probability > cur_prob) { 240 MINSTREL_FRAC(3, 4)) || mr->probability > cur_prob) {
241 mg->max_prob_rate = index; 241 mg->max_prob_rate = index;
242 cur_prob = mr->probability; 242 cur_prob = mr->probability;
243 cur_prob_tp = mr->cur_tp;
243 } 244 }
244 245
245 if (mr->cur_tp > cur_tp) { 246 if (mr->cur_tp > cur_tp) {
@@ -275,6 +276,7 @@ minstrel_ht_update_stats(struct minstrel_priv *mp, struct minstrel_ht_sta *mi)
275 minstrel_mcs_groups[group].streams == 1) { 276 minstrel_mcs_groups[group].streams == 1) {
276 mi->max_prob_rate = mg->max_prob_rate; 277 mi->max_prob_rate = mg->max_prob_rate;
277 cur_prob = mr->cur_prob; 278 cur_prob = mr->cur_prob;
279 cur_prob_tp = mr->cur_tp;
278 } 280 }
279 281
280 mr = minstrel_get_ratestats(mi, mg->max_tp_rate); 282 mr = minstrel_get_ratestats(mi, mg->max_tp_rate);
@@ -441,8 +443,8 @@ minstrel_ht_tx_status(void *priv, struct ieee80211_supported_band *sband,
441 minstrel_downgrade_rate(mi, &mi->max_tp_rate, true); 443 minstrel_downgrade_rate(mi, &mi->max_tp_rate, true);
442 444
443 rate2 = minstrel_get_ratestats(mi, mi->max_tp_rate2); 445 rate2 = minstrel_get_ratestats(mi, mi->max_tp_rate2);
444 if (rate->attempts > 30 && 446 if (rate2->attempts > 30 &&
445 MINSTREL_FRAC(rate->success, rate->attempts) < 447 MINSTREL_FRAC(rate2->success, rate2->attempts) <
446 MINSTREL_FRAC(20, 100)) 448 MINSTREL_FRAC(20, 100))
447 minstrel_downgrade_rate(mi, &mi->max_tp_rate2, false); 449 minstrel_downgrade_rate(mi, &mi->max_tp_rate2, false);
448 450
diff --git a/net/mac80211/tkip.c b/net/mac80211/tkip.c
index 7ef491e9d66..e840c9cd46d 100644
--- a/net/mac80211/tkip.c
+++ b/net/mac80211/tkip.c
@@ -202,9 +202,9 @@ EXPORT_SYMBOL(ieee80211_get_tkip_key);
202 * @payload_len is the length of payload (_not_ including IV/ICV length). 202 * @payload_len is the length of payload (_not_ including IV/ICV length).
203 * @ta is the transmitter addresses. 203 * @ta is the transmitter addresses.
204 */ 204 */
205void ieee80211_tkip_encrypt_data(struct crypto_blkcipher *tfm, 205int ieee80211_tkip_encrypt_data(struct crypto_blkcipher *tfm,
206 struct ieee80211_key *key, 206 struct ieee80211_key *key,
207 u8 *pos, size_t payload_len, u8 *ta) 207 u8 *pos, size_t payload_len, u8 *ta)
208{ 208{
209 u8 rc4key[16]; 209 u8 rc4key[16];
210 struct tkip_ctx *ctx = &key->u.tkip.tx; 210 struct tkip_ctx *ctx = &key->u.tkip.tx;
@@ -216,7 +216,7 @@ void ieee80211_tkip_encrypt_data(struct crypto_blkcipher *tfm,
216 216
217 tkip_mixing_phase2(tk, ctx, ctx->iv16, rc4key); 217 tkip_mixing_phase2(tk, ctx, ctx->iv16, rc4key);
218 218
219 ieee80211_wep_encrypt_data(tfm, rc4key, 16, pos, payload_len); 219 return ieee80211_wep_encrypt_data(tfm, rc4key, 16, pos, payload_len);
220} 220}
221 221
222/* Decrypt packet payload with TKIP using @key. @pos is a pointer to the 222/* Decrypt packet payload with TKIP using @key. @pos is a pointer to the
diff --git a/net/mac80211/tkip.h b/net/mac80211/tkip.h
index d4714383f5f..7e83dee976f 100644
--- a/net/mac80211/tkip.h
+++ b/net/mac80211/tkip.h
@@ -15,7 +15,7 @@
15 15
16u8 *ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key, u16 iv16); 16u8 *ieee80211_tkip_add_iv(u8 *pos, struct ieee80211_key *key, u16 iv16);
17 17
18void ieee80211_tkip_encrypt_data(struct crypto_blkcipher *tfm, 18int ieee80211_tkip_encrypt_data(struct crypto_blkcipher *tfm,
19 struct ieee80211_key *key, 19 struct ieee80211_key *key,
20 u8 *pos, size_t payload_len, u8 *ta); 20 u8 *pos, size_t payload_len, u8 *ta);
21enum { 21enum {
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index 5f3a4113bda..6d133b6efce 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -47,8 +47,10 @@ int ieee80211_wep_init(struct ieee80211_local *local)
47 47
48void ieee80211_wep_free(struct ieee80211_local *local) 48void ieee80211_wep_free(struct ieee80211_local *local)
49{ 49{
50 crypto_free_blkcipher(local->wep_tx_tfm); 50 if (!IS_ERR(local->wep_tx_tfm))
51 crypto_free_blkcipher(local->wep_rx_tfm); 51 crypto_free_blkcipher(local->wep_tx_tfm);
52 if (!IS_ERR(local->wep_rx_tfm))
53 crypto_free_blkcipher(local->wep_rx_tfm);
52} 54}
53 55
54static inline bool ieee80211_wep_weak_iv(u32 iv, int keylen) 56static inline bool ieee80211_wep_weak_iv(u32 iv, int keylen)
@@ -122,19 +124,24 @@ static void ieee80211_wep_remove_iv(struct ieee80211_local *local,
122/* Perform WEP encryption using given key. data buffer must have tailroom 124/* Perform WEP encryption using given key. data buffer must have tailroom
123 * for 4-byte ICV. data_len must not include this ICV. Note: this function 125 * for 4-byte ICV. data_len must not include this ICV. Note: this function
124 * does _not_ add IV. data = RC4(data | CRC32(data)) */ 126 * does _not_ add IV. data = RC4(data | CRC32(data)) */
125void ieee80211_wep_encrypt_data(struct crypto_blkcipher *tfm, u8 *rc4key, 127int ieee80211_wep_encrypt_data(struct crypto_blkcipher *tfm, u8 *rc4key,
126 size_t klen, u8 *data, size_t data_len) 128 size_t klen, u8 *data, size_t data_len)
127{ 129{
128 struct blkcipher_desc desc = { .tfm = tfm }; 130 struct blkcipher_desc desc = { .tfm = tfm };
129 struct scatterlist sg; 131 struct scatterlist sg;
130 __le32 icv; 132 __le32 icv;
131 133
134 if (IS_ERR(tfm))
135 return -1;
136
132 icv = cpu_to_le32(~crc32_le(~0, data, data_len)); 137 icv = cpu_to_le32(~crc32_le(~0, data, data_len));
133 put_unaligned(icv, (__le32 *)(data + data_len)); 138 put_unaligned(icv, (__le32 *)(data + data_len));
134 139
135 crypto_blkcipher_setkey(tfm, rc4key, klen); 140 crypto_blkcipher_setkey(tfm, rc4key, klen);
136 sg_init_one(&sg, data, data_len + WEP_ICV_LEN); 141 sg_init_one(&sg, data, data_len + WEP_ICV_LEN);
137 crypto_blkcipher_encrypt(&desc, &sg, &sg, sg.length); 142 crypto_blkcipher_encrypt(&desc, &sg, &sg, sg.length);
143
144 return 0;
138} 145}
139 146
140 147
@@ -168,10 +175,8 @@ int ieee80211_wep_encrypt(struct ieee80211_local *local,
168 /* Add room for ICV */ 175 /* Add room for ICV */
169 skb_put(skb, WEP_ICV_LEN); 176 skb_put(skb, WEP_ICV_LEN);
170 177
171 ieee80211_wep_encrypt_data(local->wep_tx_tfm, rc4key, keylen + 3, 178 return ieee80211_wep_encrypt_data(local->wep_tx_tfm, rc4key, keylen + 3,
172 iv + WEP_IV_LEN, len); 179 iv + WEP_IV_LEN, len);
173
174 return 0;
175} 180}
176 181
177 182
@@ -185,6 +190,9 @@ int ieee80211_wep_decrypt_data(struct crypto_blkcipher *tfm, u8 *rc4key,
185 struct scatterlist sg; 190 struct scatterlist sg;
186 __le32 crc; 191 __le32 crc;
187 192
193 if (IS_ERR(tfm))
194 return -1;
195
188 crypto_blkcipher_setkey(tfm, rc4key, klen); 196 crypto_blkcipher_setkey(tfm, rc4key, klen);
189 sg_init_one(&sg, data, data_len + WEP_ICV_LEN); 197 sg_init_one(&sg, data, data_len + WEP_ICV_LEN);
190 crypto_blkcipher_decrypt(&desc, &sg, &sg, sg.length); 198 crypto_blkcipher_decrypt(&desc, &sg, &sg, sg.length);
diff --git a/net/mac80211/wep.h b/net/mac80211/wep.h
index fe29d7e5759..58654ee3351 100644
--- a/net/mac80211/wep.h
+++ b/net/mac80211/wep.h
@@ -18,7 +18,7 @@
18 18
19int ieee80211_wep_init(struct ieee80211_local *local); 19int ieee80211_wep_init(struct ieee80211_local *local);
20void ieee80211_wep_free(struct ieee80211_local *local); 20void ieee80211_wep_free(struct ieee80211_local *local);
21void ieee80211_wep_encrypt_data(struct crypto_blkcipher *tfm, u8 *rc4key, 21int ieee80211_wep_encrypt_data(struct crypto_blkcipher *tfm, u8 *rc4key,
22 size_t klen, u8 *data, size_t data_len); 22 size_t klen, u8 *data, size_t data_len);
23int ieee80211_wep_encrypt(struct ieee80211_local *local, 23int ieee80211_wep_encrypt(struct ieee80211_local *local,
24 struct sk_buff *skb, 24 struct sk_buff *skb,
diff --git a/net/mac80211/wpa.c b/net/mac80211/wpa.c
index a14e6770747..8d59d27d887 100644
--- a/net/mac80211/wpa.c
+++ b/net/mac80211/wpa.c
@@ -183,9 +183,8 @@ static int tkip_encrypt_skb(struct ieee80211_tx_data *tx, struct sk_buff *skb)
183 skb_put(skb, TKIP_ICV_LEN); 183 skb_put(skb, TKIP_ICV_LEN);
184 184
185 hdr = (struct ieee80211_hdr *) skb->data; 185 hdr = (struct ieee80211_hdr *) skb->data;
186 ieee80211_tkip_encrypt_data(tx->local->wep_tx_tfm, 186 return ieee80211_tkip_encrypt_data(tx->local->wep_tx_tfm,
187 key, pos, len, hdr->addr2); 187 key, pos, len, hdr->addr2);
188 return 0;
189} 188}
190 189
191 190
diff --git a/net/wireless/mlme.c b/net/wireless/mlme.c
index 9f95354f859..e74a1a2119d 100644
--- a/net/wireless/mlme.c
+++ b/net/wireless/mlme.c
@@ -44,10 +44,10 @@ void cfg80211_send_rx_auth(struct net_device *dev, const u8 *buf, size_t len)
44 } 44 }
45 } 45 }
46 46
47 WARN_ON(!done); 47 if (done) {
48 48 nl80211_send_rx_auth(rdev, dev, buf, len, GFP_KERNEL);
49 nl80211_send_rx_auth(rdev, dev, buf, len, GFP_KERNEL); 49 cfg80211_sme_rx_auth(dev, buf, len);
50 cfg80211_sme_rx_auth(dev, buf, len); 50 }
51 51
52 wdev_unlock(wdev); 52 wdev_unlock(wdev);
53} 53}
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c
index 85285b43d37..fbfac588297 100644
--- a/net/wireless/nl80211.c
+++ b/net/wireless/nl80211.c
@@ -877,7 +877,7 @@ static int nl80211_set_wiphy(struct sk_buff *skb, struct genl_info *info)
877 int idx, mbm = 0; 877 int idx, mbm = 0;
878 878
879 if (!rdev->ops->set_tx_power) { 879 if (!rdev->ops->set_tx_power) {
880 return -EOPNOTSUPP; 880 result = -EOPNOTSUPP;
881 goto bad_res; 881 goto bad_res;
882 } 882 }
883 883