lkml.org 
[lkml]   [2015]   [Apr]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 4/6] crypto: drbg - add async seeding operation
On Tue, Apr 28, 2015 at 05:00:03AM +0200, Stephan Mueller wrote:
>
> @@ -1081,6 +1115,11 @@ static int drbg_seed(struct drbg_state *drbg, struct drbg_string *pers,
> return -EINVAL;
> }
>
> + /* cancel any previously invoked seeding */
> + mutex_unlock(&drbg->drbg_mutex);
> + drbg_async_work_cancel(&drbg->seed_work);
> + mutex_lock(&drbg->drbg_mutex);

This seems dangerous and unnecessary. Releasing and reacquiring
the locks may invalidate previous checks. Even if it doesn't
matter today if somebody modifies the callers later on this could
explode.

You can easily remove this by making get_blocking_random_bytes_cb
idempotent, i.e., do nothing if the work is already queued, which
is what it would do anyway if you simply move the INIT_WORK out of
it.

Cheers,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt


\
 
 \ /
  Last update: 2015-05-01 05:41    [W:0.064 / U:0.236 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site