lkml.org 
[lkml]   [2020]   [Jun]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v2] crypto: DRBG - always try to free Jitter RNG instance
On Thu, Jun 04, 2020 at 08:41:00AM +0200, Stephan Müller wrote:
> The Jitter RNG is unconditionally allocated as a seed source follwoing
> the patch 97f2650e5040. Thus, the instance must always be deallocated.
>
> Reported-by: syzbot+2e635807decef724a1fa@syzkaller.appspotmail.com
> Fixes: 97f2650e5040 ("crypto: drbg - always seeded with SP800-90B ...")
> Signed-off-by: Stephan Mueller <smueller@chronox.de>
> ---
> crypto/drbg.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/crypto/drbg.c b/crypto/drbg.c
> index 37526eb8c5d5..8a0f16950144 100644
> --- a/crypto/drbg.c
> +++ b/crypto/drbg.c
> @@ -1631,6 +1631,9 @@ static int drbg_uninstantiate(struct drbg_state *drbg)
> if (drbg->random_ready.func) {
> del_random_ready_callback(&drbg->random_ready);
> cancel_work_sync(&drbg->seed_work);
> + }
> +
> + if (!IS_ERR_OR_NULL(drbg->jent)) {
> crypto_free_rng(drbg->jent);
> drbg->jent = NULL;
> }

It it okay that ->jent can be left as an ERR_PTR() value?

Perhaps it should always be set to NULL?

- Eric

\
 
 \ /
  Last update: 2020-06-05 02:44    [W:0.123 / U:2.764 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site