Commit 7ede5a5ba55a696a6e1d8456526e44635e966a81

Authored by Herbert Xu
1 parent ef5d590c9b

crypto: api - Fix crypto_drop_spawn crash on blank spawns

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>

Showing 1 changed file with 3 additions and 0 deletions Side-by-side Diff

... ... @@ -507,6 +507,9 @@
507 507  
508 508 void crypto_drop_spawn(struct crypto_spawn *spawn)
509 509 {
  510 + if (!spawn->alg)
  511 + return;
  512 +
510 513 down_write(&crypto_alg_sem);
511 514 list_del(&spawn->list);
512 515 up_write(&crypto_alg_sem);