crypto: skcipher - avoid NULL dereference
authorJiri Slaby <jslaby@suse.cz>
Wed, 23 Jun 2010 10:01:45 +0000 (20:01 +1000)
committerHerbert Xu <herbert@gondor.apana.org.au>
Wed, 23 Jun 2010 10:01:45 +0000 (20:01 +1000)
Stanse found a potential NULL dereference in ablkcipher_next_slow.
Even though kmalloc fails, its retval is dereferenced later. Return
from that function properly earlier.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/ablkcipher.c

index 98a6610..a854df2 100644 (file)
@@ -165,7 +165,7 @@ static inline int ablkcipher_next_slow(struct ablkcipher_request *req,
 
        p = kmalloc(n, GFP_ATOMIC);
        if (!p)
-               ablkcipher_walk_done(req, walk, -ENOMEM);
+               return ablkcipher_walk_done(req, walk, -ENOMEM);
 
        base = p + 1;