Skip to content

Commit

Permalink
crypto: shash - Fix module refcount
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
Adrian-Ken Rueegsegger authored and herbertx committed Feb 5, 2009
1 parent b8e1599 commit 4abfd73
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion crypto/shash.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 4abfd73

Please sign in to comment.