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]
Message-ID: <YhKVdOI02tnvOl7R@Red>
Date:   Sun, 20 Feb 2022 20:24:36 +0100
From:   Corentin Labbe <clabbe.montjoie@...il.com>
To:     Gilad Ben-Yossef <gilad@...yossef.com>
Cc:     Herbert Xu <herbert@...dor.apana.org.au>,
        "David S. Miller" <davem@...emloft.net>,
        Ofir Drang <ofir.drang@....com>, linux-crypto@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] crypto: ccree: don't attempt 0 len DMA mappings

Le Thu, Feb 17, 2022 at 09:27:26PM +0200, Gilad Ben-Yossef a écrit :
> Refuse to try mapping zero bytes as this may cause a fault
> on some configurations / platforms and it seems the prev.
> attempt is not enough and we need to be more explicit.
> 
> Signed-off-by: Gilad Ben-Yossef <gilad@...yossef.com>
> Reported-by: Corentin Labbe <clabbe.montjoie@...il.com>
> Fixes: ce0fc6db38de ("crypto: ccree - protect against empty or NULL
> scatterlists")
> ---
>  drivers/crypto/ccree/cc_buffer_mgr.c | 7 +++++++
>  1 file changed, 7 insertions(+)
> 
> diff --git a/drivers/crypto/ccree/cc_buffer_mgr.c b/drivers/crypto/ccree/cc_buffer_mgr.c
> index a5e041d9d2cf..11e0278c8631 100644
> --- a/drivers/crypto/ccree/cc_buffer_mgr.c
> +++ b/drivers/crypto/ccree/cc_buffer_mgr.c
> @@ -258,6 +258,13 @@ static int cc_map_sg(struct device *dev, struct scatterlist *sg,
>  {
>  	int ret = 0;
>  
> +	if (!nbytes) {
> +		*mapped_nents = 0;
> +		*lbytes = 0;
> +		*nents = 0;
> +		return 0;
> +	}
> +
>  	*nents = cc_get_sgl_nents(dev, sg, nbytes, lbytes);
>  	if (*nents > max_sg_nents) {
>  		*nents = 0;
> -- 
> 2.25.1
> 

Hello

With this patch, the stacktrace I reported is not present anymore.

Tested-by: Corentin Labbe <clabbe.montjoie@...il.com>
Tested-on: r8a7795-salvator-x

Regards

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ