Re: [PATCH] crypto: api - Check spawn->alg under lock in crypto_drop_spawn

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

 



On Fri, Dec 06, 2019 at 01:55:17PM +0800, Herbert Xu wrote:
> We need to check whether spawn->alg is NULL under lock as otherwise
> the algorithm could be removed from under us after we have checked
> it and found it to be non-NULL.  This could cause us to remove the
> spawn from a non-existent list.
> 
> Fixes: 6bfd48096ff8 ("[CRYPTO] api: Added spawns")
> Cc: <stable@xxxxxxxxxxxxxxx>
> Signed-off-by: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
> 
> diff --git a/crypto/algapi.c b/crypto/algapi.c
> index 783006f4d339..6869feb31c99 100644
> --- a/crypto/algapi.c
> +++ b/crypto/algapi.c
> @@ -668,11 +668,9 @@ EXPORT_SYMBOL_GPL(crypto_grab_spawn);
>  
>  void crypto_drop_spawn(struct crypto_spawn *spawn)
>  {
> -	if (!spawn->alg)
> -		return;
> -
>  	down_write(&crypto_alg_sem);
> -	list_del(&spawn->list);
> +	if (spawn->alg)
> +		list_del(&spawn->list);
>  	up_write(&crypto_alg_sem);
>  }
>  EXPORT_SYMBOL_GPL(crypto_drop_spawn);

Seems the Fixes tag is wrong.  It should be:

Fixes: 7ede5a5ba55a ("crypto: api - Fix crypto_drop_spawn crash on blank spawns")

- Eric



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux