Skip to content

Commit 819966c

Browse files
smuellerDDherbertx
authored andcommitted
crypto: drbg - always try to free Jitter RNG instance
The Jitter RNG is unconditionally allocated as a seed source follwoing the patch 97f2650. Thus, the instance must always be deallocated. Reported-by: [email protected] Fixes: 97f2650 ("crypto: drbg - always seeded with SP800-90B ...") Signed-off-by: Stephan Mueller <[email protected]> Signed-off-by: Herbert Xu <[email protected]>
1 parent 1f5b07f commit 819966c

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

crypto/drbg.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1631,10 +1631,12 @@ static int drbg_uninstantiate(struct drbg_state *drbg)
16311631
if (drbg->random_ready.func) {
16321632
del_random_ready_callback(&drbg->random_ready);
16331633
cancel_work_sync(&drbg->seed_work);
1634-
crypto_free_rng(drbg->jent);
1635-
drbg->jent = NULL;
16361634
}
16371635

1636+
if (!IS_ERR_OR_NULL(drbg->jent))
1637+
crypto_free_rng(drbg->jent);
1638+
drbg->jent = NULL;
1639+
16381640
if (drbg->d_ops)
16391641
drbg->d_ops->crypto_fini(drbg);
16401642
drbg_dealloc_state(drbg);

0 commit comments

Comments
 (0)