crypto: api - Fix crypto_drop_spawn crash on blank spawns
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 9 Jul 2009 03:34:06 +0000 (11:34 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 9 Jul 2009 03:34:06 +0000 (11:34 +0800)
This patch allows crypto_drop_spawn to be called on spawns that
have not been initialised or have failed initialisation.  This
fixes potential crashes during initialisation without adding
special case code.

Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
crypto/algapi.c

index 2154815..6a98076 100644 (file)
@@ -507,6 +507,9 @@ EXPORT_SYMBOL_GPL(crypto_init_spawn2);
 
 void crypto_drop_spawn(struct crypto_spawn *spawn)
 {
+       if (!spawn->alg)
+               return;
+
        down_write(&crypto_alg_sem);
        list_del(&spawn->list);
        up_write(&crypto_alg_sem);