]> git.baikalelectronics.ru Git - kernel.git/commit
crypto: fix broken crypto_register_instance() module handling
authorHerbert Xu <herbert@gondor.apana.org.au>
Thu, 16 Apr 2015 03:07:13 +0000 (11:07 +0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 16 Apr 2015 03:26:16 +0000 (20:26 -0700)
commit19cba4a19c666b12a80ce2e6cdc1a9f215156f61
tree293687562728755c0cd9186bfa8f9137a6b1cc92
parent63f13447edf07404afbfa5673f11b470f718ea03
crypto: fix broken crypto_register_instance() module handling

Commit 4ca762c7ccd4 ("crypto: api - remove instance when test failed")
tried to grab a module reference count before the module was even set.

Worse, it then goes on to free the module reference count after it is
set so you quickly end up with a negative module reference count which
prevents people from using any instances belonging to that module.

This patch moves the module initialisation before the reference
count.

Reported-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
crypto/algapi.c