summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorHong Liu <hong.liu@intel.com>2005-10-20 11:06:36 -0500
committerJames Ketrenos <jketreno@linux.intel.com>2005-10-20 11:06:36 -0500
commitf0f15ab5542f73d07e35eeee713df289599427b2 (patch)
tree4e511a4d571f5cf9838c99bd9bb5b6e06a06e263 /net
parent5b74eda78db410b979b7d450221c971fdebf5d29 (diff)
downloadop-kernel-dev-f0f15ab5542f73d07e35eeee713df289599427b2.zip
op-kernel-dev-f0f15ab5542f73d07e35eeee713df289599427b2.tar.gz
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')
-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 2955b7a..f4f2a33 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,
struct ieee80211_crypt_data *crypt = ieee->crypt[ieee->tx_keyidx];
int res;
+ if (crypt == NULL)
+ return -1;
+
/* To encrypt, frame format is:
* IV (4 bytes), clear payload (including SNAP), ICV (4 bytes) */
atomic_inc(&crypt->refcnt);
res = 0;
- if (crypt->ops->encrypt_mpdu)
+ if (crypt->ops && crypt->ops->encrypt_mpdu)
res = crypt->ops->encrypt_mpdu(frag, hdr_len, crypt->priv);
atomic_dec(&crypt->refcnt);
@@ -264,9 +267,9 @@ int ieee80211_xmit(struct sk_buff *skb, struct net_device *dev)
encrypt = !(ether_type == ETH_P_PAE && ieee->ieee802_1x) &&
ieee->sec.encrypt;
- host_encrypt = ieee->host_encrypt && encrypt;
- host_encrypt_msdu = ieee->host_encrypt_msdu && encrypt;
- host_build_iv = ieee->host_build_iv && encrypt;
+ host_encrypt = ieee->host_encrypt && encrypt && crypt;
+ host_encrypt_msdu = ieee->host_encrypt_msdu && encrypt && crypt;
+ host_build_iv = ieee->host_build_iv && encrypt && crypt;
if (!encrypt && ieee->ieee802_1x &&
ieee->drop_unencrypted && ether_type != ETH_P_PAE) {
OpenPOWER on IntegriCloud