crypto: api - Fix races in crypto_unregister_instance
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 2 Apr 2015 14:31:22 +0000 (22:31 +0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Fri, 3 Apr 2015 09:53:32 +0000 (17:53 +0800)
There are multiple problems in crypto_unregister_instance:

1) The cra_refcnt BUG_ON check is racy and can cause crashes.
2) The cra_refcnt check shouldn't exist at all.
3) There is no reference on tmpl to protect the tmpl->free call.

This patch rewrites the function using crypto_remove_spawn which
now morphs into crypto_remove_instance.

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

diff --cc crypto/algapi.c
Simple merge