mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-03-30 11:04:25 +00:00
crypto: shash - Fix module refcount
Module reference counting for shash is incorrect: when a new shash transformation is created the refcount is not increased as it should. Signed-off-by: Adrian-Ken Rueegsegger <rueegsegger@swiss-it.ch> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
b8e15992b4
commit
4abfd73e34
1 changed files with 6 additions and 1 deletions
|
@ -388,10 +388,15 @@ static int crypto_init_shash_ops_compat(struct crypto_tfm *tfm)
|
||||||
struct shash_desc *desc = crypto_tfm_ctx(tfm);
|
struct shash_desc *desc = crypto_tfm_ctx(tfm);
|
||||||
struct crypto_shash *shash;
|
struct crypto_shash *shash;
|
||||||
|
|
||||||
|
if (!crypto_mod_get(calg))
|
||||||
|
return -EAGAIN;
|
||||||
|
|
||||||
shash = __crypto_shash_cast(crypto_create_tfm(
|
shash = __crypto_shash_cast(crypto_create_tfm(
|
||||||
calg, &crypto_shash_type));
|
calg, &crypto_shash_type));
|
||||||
if (IS_ERR(shash))
|
if (IS_ERR(shash)) {
|
||||||
|
crypto_mod_put(calg);
|
||||||
return PTR_ERR(shash);
|
return PTR_ERR(shash);
|
||||||
|
}
|
||||||
|
|
||||||
desc->tfm = shash;
|
desc->tfm = shash;
|
||||||
tfm->exit = crypto_exit_shash_ops_compat;
|
tfm->exit = crypto_exit_shash_ops_compat;
|
||||||
|
|
Loading…
Add table
Reference in a new issue