aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211
diff options
context:
space:
mode:
Diffstat (limited to 'net/mac80211')
-rw-r--r--net/mac80211/ieee80211_ioctl.c19
-rw-r--r--net/mac80211/key.c1
-rw-r--r--net/mac80211/rx.c3
-rw-r--r--net/mac80211/tx.c2
4 files changed, 11 insertions, 14 deletions
diff --git a/net/mac80211/ieee80211_ioctl.c b/net/mac80211/ieee80211_ioctl.c
index 48e68434b38a..6c8e73e0d29d 100644
--- a/net/mac80211/ieee80211_ioctl.c
+++ b/net/mac80211/ieee80211_ioctl.c
@@ -27,8 +27,9 @@
27 27
28 28
29static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr, 29static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
30 int idx, int alg, int set_tx_key, 30 int idx, int alg, int remove,
31 const u8 *_key, size_t key_len) 31 int set_tx_key, const u8 *_key,
32 size_t key_len)
32{ 33{
33 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); 34 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
34 int ret = 0; 35 int ret = 0;
@@ -75,7 +76,7 @@ static int ieee80211_set_encryption(struct net_device *dev, u8 *sta_addr,
75 key = sta->key; 76 key = sta->key;
76 } 77 }
77 78
78 if (alg == ALG_NONE) { 79 if (remove) {
79 ieee80211_key_free(key); 80 ieee80211_key_free(key);
80 key = NULL; 81 key = NULL;
81 } else { 82 } else {
@@ -827,6 +828,7 @@ static int ieee80211_ioctl_siwencode(struct net_device *dev,
827 struct ieee80211_sub_if_data *sdata; 828 struct ieee80211_sub_if_data *sdata;
828 int idx, i, alg = ALG_WEP; 829 int idx, i, alg = ALG_WEP;
829 u8 bcaddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 830 u8 bcaddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
831 int remove = 0;
830 832
831 sdata = IEEE80211_DEV_TO_SUB_IF(dev); 833 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
832 834
@@ -845,7 +847,7 @@ static int ieee80211_ioctl_siwencode(struct net_device *dev,
845 idx--; 847 idx--;
846 848
847 if (erq->flags & IW_ENCODE_DISABLED) 849 if (erq->flags & IW_ENCODE_DISABLED)
848 alg = ALG_NONE; 850 remove = 1;
849 else if (erq->length == 0) { 851 else if (erq->length == 0) {
850 /* No key data - just set the default TX key index */ 852 /* No key data - just set the default TX key index */
851 ieee80211_set_default_key(sdata, idx); 853 ieee80211_set_default_key(sdata, idx);
@@ -854,7 +856,7 @@ static int ieee80211_ioctl_siwencode(struct net_device *dev,
854 856
855 return ieee80211_set_encryption( 857 return ieee80211_set_encryption(
856 dev, bcaddr, 858 dev, bcaddr,
857 idx, alg, 859 idx, alg, remove,
858 !sdata->default_key, 860 !sdata->default_key,
859 keybuf, erq->length); 861 keybuf, erq->length);
860} 862}
@@ -1005,11 +1007,11 @@ static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
1005{ 1007{
1006 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 1008 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
1007 struct iw_encode_ext *ext = (struct iw_encode_ext *) extra; 1009 struct iw_encode_ext *ext = (struct iw_encode_ext *) extra;
1008 int alg, idx, i; 1010 int uninitialized_var(alg), idx, i, remove = 0;
1009 1011
1010 switch (ext->alg) { 1012 switch (ext->alg) {
1011 case IW_ENCODE_ALG_NONE: 1013 case IW_ENCODE_ALG_NONE:
1012 alg = ALG_NONE; 1014 remove = 1;
1013 break; 1015 break;
1014 case IW_ENCODE_ALG_WEP: 1016 case IW_ENCODE_ALG_WEP:
1015 alg = ALG_WEP; 1017 alg = ALG_WEP;
@@ -1025,7 +1027,7 @@ static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
1025 } 1027 }
1026 1028
1027 if (erq->flags & IW_ENCODE_DISABLED) 1029 if (erq->flags & IW_ENCODE_DISABLED)
1028 alg = ALG_NONE; 1030 remove = 1;
1029 1031
1030 idx = erq->flags & IW_ENCODE_INDEX; 1032 idx = erq->flags & IW_ENCODE_INDEX;
1031 if (idx < 1 || idx > 4) { 1033 if (idx < 1 || idx > 4) {
@@ -1044,6 +1046,7 @@ static int ieee80211_ioctl_siwencodeext(struct net_device *dev,
1044 idx--; 1046 idx--;
1045 1047
1046 return ieee80211_set_encryption(dev, ext->addr.sa_data, idx, alg, 1048 return ieee80211_set_encryption(dev, ext->addr.sa_data, idx, alg,
1049 remove,
1047 ext->ext_flags & 1050 ext->ext_flags &
1048 IW_ENCODE_EXT_SET_TX_KEY, 1051 IW_ENCODE_EXT_SET_TX_KEY,
1049 ext->key, ext->key_len); 1052 ext->key, ext->key_len);
diff --git a/net/mac80211/key.c b/net/mac80211/key.c
index f13d46b2c13c..0b2328f7d67c 100644
--- a/net/mac80211/key.c
+++ b/net/mac80211/key.c
@@ -121,7 +121,6 @@ struct ieee80211_key *ieee80211_key_alloc(struct ieee80211_sub_if_data *sdata,
121 struct ieee80211_key *key; 121 struct ieee80211_key *key;
122 122
123 BUG_ON(idx < 0 || idx >= NUM_DEFAULT_KEYS); 123 BUG_ON(idx < 0 || idx >= NUM_DEFAULT_KEYS);
124 BUG_ON(alg == ALG_NONE);
125 124
126 key = kzalloc(sizeof(struct ieee80211_key) + key_len, GFP_KERNEL); 125 key = kzalloc(sizeof(struct ieee80211_key) + key_len, GFP_KERNEL);
127 if (!key) 126 if (!key)
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index f5caa1a016ee..8c16574ec39c 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -532,9 +532,6 @@ ieee80211_rx_h_decrypt(struct ieee80211_txrx_data *rx)
532 return ieee80211_crypto_tkip_decrypt(rx); 532 return ieee80211_crypto_tkip_decrypt(rx);
533 case ALG_CCMP: 533 case ALG_CCMP:
534 return ieee80211_crypto_ccmp_decrypt(rx); 534 return ieee80211_crypto_ccmp_decrypt(rx);
535 case ALG_NONE:
536 WARN_ON(1);
537 return TXRX_CONTINUE;
538 } 535 }
539 536
540 /* not reached */ 537 /* not reached */
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 8f0007a925a2..47416b0645db 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -554,8 +554,6 @@ ieee80211_tx_h_encrypt(struct ieee80211_txrx_data *tx)
554 return ieee80211_crypto_tkip_encrypt(tx); 554 return ieee80211_crypto_tkip_encrypt(tx);
555 case ALG_CCMP: 555 case ALG_CCMP:
556 return ieee80211_crypto_ccmp_encrypt(tx); 556 return ieee80211_crypto_ccmp_encrypt(tx);
557 case ALG_NONE:
558 return TXRX_CONTINUE;
559 } 557 }
560 558
561 /* not reached */ 559 /* not reached */