lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 28 Apr 2020 07:48:26 +0000
From:   Iuliana Prodan <iuliana.prodan@....com>
To:     Zhenzhong Duan <zhenzhong.duan@...il.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-crypto@...r.kernel.org" <linux-crypto@...r.kernel.org>
CC:     Horia Geanta <horia.geanta@....com>,
        Aymen Sghaier <aymen.sghaier@....com>,
        "herbert@...dor.apana.org.au" <herbert@...dor.apana.org.au>,
        "davem@...emloft.net" <davem@...emloft.net>
Subject: Re: [PATCH] crypto: caam - fix use after free issue in *_crypt_done

On 4/28/2020 8:14 AM, Zhenzhong Duan wrote:
> In both aead_crypt_done and skcipher_crypt_done, edesc->bklog is
> referenced after the structure pointed by edesc is freed.
> 
> Fix them by moving kfree(edesc) to the end of function call.
> 
> Signed-off-by: Zhenzhong Duan <zhenzhong.duan@...il.com>

These issues were already fixed, and applied on cryptodev, by this 
series: https://patchwork.kernel.org/cover/11476799/

Regards,
Iulia

> ---
>   drivers/crypto/caam/caamalg.c | 8 ++++----
>   1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/crypto/caam/caamalg.c b/drivers/crypto/caam/caamalg.c
> index b7bb7c30adeb..6d746ef5e650 100644
> --- a/drivers/crypto/caam/caamalg.c
> +++ b/drivers/crypto/caam/caamalg.c
> @@ -973,8 +973,6 @@ static void aead_crypt_done(struct device *jrdev, u32 *desc, u32 err,
>   
>   	aead_unmap(jrdev, edesc, req);
>   
> -	kfree(edesc);
> -
>   	/*
>   	 * If no backlog flag, the completion of the request is done
>   	 * by CAAM, not crypto engine.
> @@ -983,6 +981,8 @@ static void aead_crypt_done(struct device *jrdev, u32 *desc, u32 err,
>   		aead_request_complete(req, ecode);
>   	else
>   		crypto_finalize_aead_request(jrp->engine, req, ecode);
> +
> +	kfree(edesc);
>   }
>   
>   static void skcipher_crypt_done(struct device *jrdev, u32 *desc, u32 err,
> @@ -1022,8 +1022,6 @@ static void skcipher_crypt_done(struct device *jrdev, u32 *desc, u32 err,
>   		     DUMP_PREFIX_ADDRESS, 16, 4, req->dst,
>   		     edesc->dst_nents > 1 ? 100 : req->cryptlen, 1);
>   
> -	kfree(edesc);
> -
>   	/*
>   	 * If no backlog flag, the completion of the request is done
>   	 * by CAAM, not crypto engine.
> @@ -1032,6 +1030,8 @@ static void skcipher_crypt_done(struct device *jrdev, u32 *desc, u32 err,
>   		skcipher_request_complete(req, ecode);
>   	else
>   		crypto_finalize_skcipher_request(jrp->engine, req, ecode);
> +
> +	kfree(edesc);
>   }
>   
>   /*
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ