aboutsummaryrefslogtreecommitdiffstats
path: root/net/ieee80211/ieee80211_tx.c
diff options
context:
space:
mode:
authorHong Liu <hong.liu@intel.com>2005-10-20 12:06:36 -0400
committerJames Ketrenos <jketreno@linux.intel.com>2005-10-20 12:06:36 -0400
commitf0f15ab5542f73d07e35eeee713df289599427b2 (patch)
tree4e511a4d571f5cf9838c99bd9bb5b6e06a06e263 /net/ieee80211/ieee80211_tx.c
parent5b74eda78db410b979b7d450221c971fdebf5d29 (diff)
Fixed oops if an uninitialized key is used for encryption.
Without this patch, if you try and use a key that has not been configured, for example: % iwconfig eth1 key deadbeef00 [2] without having configured key [1], then the active key will still be [1], but privacy will now be enabled. Transmission of a packet in this situation will result in a kernel oops. Signed-off-by: James Ketrenos <jketreno@linux.intel.com>
Diffstat (limited to 'net/ieee80211/ieee80211_tx.c')
-rw-r--r--net/ieee80211/ieee80211_tx.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/net/ieee80211/ieee80211_tx.c b/net/ieee80211/ieee80211_tx.c
index 2955b7aa5a38..f4f2a33973a7 100644
--- a/net/ieee80211/ieee80211_tx.c
+++ b/net/ieee80211/ieee80211_tx.c
@@ -157,11 +157,14 @@ static inline int ieee80211_encrypt_fragment(struct ieee80211_device *ieee,
157 struct ieee80211_crypt_data *crypt = ieee->crypt[ieee->tx_keyidx]; 157 struct ieee80211_crypt_data *crypt = ieee->crypt[ieee->tx_keyidx];
158 int res; 158 int res;
159 159
160 if (crypt == NULL)
161 return -1;
162
160 /* To encrypt, frame format is: 163 /* To encrypt, frame format is:
161 * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) */ 164 * IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) */
162 atomic_inc(&crypt->refcnt); 165 atomic_inc(&crypt->refcnt);
163 res = 0; 166 res = 0;
164 if (crypt->ops->encrypt_mpdu) 167 if (crypt->ops && crypt->ops->encrypt_mpdu)
165 res = crypt->ops->encrypt_mpdu(frag, hdr_len, crypt->priv); 168 res = crypt->ops->encrypt_mpdu(frag, hdr_len, crypt->priv);
166 169
167 atomic_dec(&crypt->refcnt); 170 atomic_dec(&crypt->refcnt);
@@ -264,9 +267,9 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
264 encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) && 267 encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) &&
265 ieee->sec.encrypt; 268 ieee->sec.encrypt;
266 269
267 host_encrypt = ieee->host_encrypt && encrypt; 270 host_encrypt = ieee->host_encrypt && encrypt && crypt;
268 host_encrypt_msdu = ieee->host_encrypt_msdu && encrypt; 271 host_encrypt_msdu = ieee->host_encrypt_msdu && encrypt && crypt;
269 host_build_iv = ieee->host_build_iv && encrypt; 272 host_build_iv = ieee->host_build_iv && encrypt && crypt;
270 273
271 if (!encrypt && ieee->ieee802_1x && 274 if (!encrypt && ieee->ieee802_1x &&
272 ieee->drop_unencrypted && ether_type != ETH_P_PAE) { 275 ieee->drop_unencrypted && ether_type != ETH_P_PAE) {