mac80211: improve error checking if WEP fails to init
authorJohn W. Linville <linville@tuxdriver.com>
Thu, 15 Jul 2010 20:16:17 +0000 (16:16 -0400)
committerJohn W. Linville <linville@tuxdriver.com>
Fri, 16 Jul 2010 18:03:42 +0000 (14:03 -0400)
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>
net/mac80211/wep.c

index 6d133b6efce5ac56167f03e4850cef8612a494d9..9ebc8d8a1f5b20d3e6872610042128848ec0a4a8 100644 (file)
@@ -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);
        }