Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4abfd73e authored by Adrian-Ken Rueegsegger's avatar Adrian-Ken Rueegsegger Committed by Herbert Xu
Browse files

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: default avatarAdrian-Ken Rueegsegger <rueegsegger@swiss-it.ch>
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent b8e15992
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -388,10 +388,15 @@ static int crypto_init_shash_ops_compat(struct crypto_tfm *tfm)
	struct shash_desc *desc = crypto_tfm_ctx(tfm);
	struct crypto_shash *shash;

	if (!crypto_mod_get(calg))
		return -EAGAIN;

	shash = __crypto_shash_cast(crypto_create_tfm(
		calg, &crypto_shash_type));
	if (IS_ERR(shash))
	if (IS_ERR(shash)) {
		crypto_mod_put(calg);
		return PTR_ERR(shash);
	}

	desc->tfm = shash;
	tfm->exit = crypto_exit_shash_ops_compat;