summaryrefslogtreecommitdiffstats
path: root/net/mac80211/wep.c
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2010-07-15 22:16:17 +0200
committerJohn W. Linville <linville@tuxdriver.com>2010-07-16 20:03:42 +0200
commit088c87262bbc39a01ebcd70817d35616785908b1 (patch)
tree3ebb99b80645eaffa2ad04c9f11708f6694d24a1 /net/mac80211/wep.c
parentorinoco_usb: potential null dereference (diff)
downloadlinux-088c87262bbc39a01ebcd70817d35616785908b1.tar.xz
linux-088c87262bbc39a01ebcd70817d35616785908b1.zip
mac80211: improve error checking if WEP fails to init
Do this by poisoning the values of wep_tx_tfm and wep_rx_tfm if either crypto allocation fails. Reported-by: Stanislaw Gruszka <sgruszka@redhat.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/wep.c')
-rw-r--r--net/mac80211/wep.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/net/mac80211/wep.c b/net/mac80211/wep.c
index 6d133b6efce5..9ebc8d8a1f5b 100644
--- a/net/mac80211/wep.c
+++ b/net/mac80211/wep.c
@@ -32,13 +32,16 @@ int ieee80211_wep_init(struct ieee80211_local *local)
local->wep_tx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0,
CRYPTO_ALG_ASYNC);
- if (IS_ERR(local->wep_tx_tfm))
+ if (IS_ERR(local->wep_tx_tfm)) {
+ local->wep_rx_tfm = ERR_PTR(-EINVAL);
return PTR_ERR(local->wep_tx_tfm);
+ }
local->wep_rx_tfm = crypto_alloc_blkcipher("ecb(arc4)", 0,
CRYPTO_ALG_ASYNC);
if (IS_ERR(local->wep_rx_tfm)) {
crypto_free_blkcipher(local->wep_tx_tfm);
+ local->wep_tx_tfm = ERR_PTR(-EINVAL);
return PTR_ERR(local->wep_rx_tfm);
}