Re: [PATCH] Remove redundant wait for completion

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 2019-12-13 11:18:43 [+0200], John Mathew wrote:
> Wait and completion was bieng done to
> uninitialized member variable of casted

Why was it uninitialized? If the 'larval' variables is not initialized
then complete_all() would fail.

> pointer. cryptomgr_probe completes all
> the waits when it completes itself. This
> causes the number of wakes to exceed the
> limit of 2.
> 
> This prevents swake_up_all_locked warnings.
> 
> Signed-off-by: John Mathew <john.mathew@xxxxxxxxxx>
> ---
>  crypto/api.c | 13 +------------
>  1 file changed, 1 insertion(+), 12 deletions(-)
> 
> diff --git a/crypto/api.c b/crypto/api.c
> index d8ba54142620..b89c44c11c54 100644
> --- a/crypto/api.c
> +++ b/crypto/api.c
> @@ -153,12 +153,9 @@ static struct crypto_alg *crypto_larval_add(const char *name, u32 type,
>  
>  void crypto_larval_kill(struct crypto_alg *alg)
>  {
> -	struct crypto_larval *larval = (void *)alg;
> -
>  	down_write(&crypto_alg_sem);
>  	list_del(&alg->cra_list);
>  	up_write(&crypto_alg_sem);
> -	complete_all(&larval->completion);
>  	crypto_alg_put(alg);
>  }
>  EXPORT_SYMBOL_GPL(crypto_larval_kill);
> @@ -166,17 +163,9 @@ EXPORT_SYMBOL_GPL(crypto_larval_kill);
>  static struct crypto_alg *crypto_larval_wait(struct crypto_alg *alg)
>  {
>  	struct crypto_larval *larval = (void *)alg;
> -	long timeout;
> -
> -	timeout = wait_for_completion_killable_timeout(
> -		&larval->completion, 60 * HZ);
>  
>  	alg = larval->adult;
> -	if (timeout < 0)
> -		alg = ERR_PTR(-EINTR);
> -	else if (!timeout)
> -		alg = ERR_PTR(-ETIMEDOUT);
> -	else if (!alg)

I don't think this is correct. You remove the synchronisation but you
don't state why this is correct in all cases.

> +	if (!alg)
>  		alg = ERR_PTR(-ENOENT);
>  	else if (crypto_is_test_larval(larval) &&
>  		 !(alg->cra_flags & CRYPTO_ALG_TESTED))
Sebastian



[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux