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] [day] [month] [year] [list]
Message-ID: <20230130170524.295c27af@xps-13>
Date:   Mon, 30 Jan 2023 17:05:24 +0100
From:   Miquel Raynal <miquel.raynal@...tlin.com>
To:     Daniel Golle <daniel@...rotopia.org>
Cc:     linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org,
        Richard Weinberger <richard@....at>,
        Vignesh Raghavendra <vigneshr@...com>,
        Mason Yang <masonccyang@...c.com.tw>,
        Jianhui Zhao <zhaojh329@...il.com>
Subject: Re: [PATCH] mtd: spinand: macronix: use scratch buffer for DMA
 operation

Hi Daniel,

daniel@...rotopia.org wrote on Thu, 19 Jan 2023 03:45:43 +0000:

> The mx35lf1ge4ab_get_eccsr() function uses an SPI DMA operation to
> read the eccsr, hence the buffer should not be on stack. Since commit
> 380583227c0c7f ("spi: spi-mem: Add extra sanity checks on the op param")
> the kernel emmits a warning and blocks such operations.
> 
> Use the scratch buffer to get eccsr instead of trying to directly read
> into a stack-allocated variable.
> 
> Signed-off-by: Daniel Golle <daniel@...rotopia.org>
> ---

Looks like my scripts did not properly sent the "applied" e-mail, so
here it is, I applied this patch to nand/next.

>  drivers/mtd/nand/spi/macronix.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/nand/spi/macronix.c b/drivers/mtd/nand/spi/macronix.c
> index dce835132a1e2..722a9738ba370 100644
> --- a/drivers/mtd/nand/spi/macronix.c
> +++ b/drivers/mtd/nand/spi/macronix.c
> @@ -83,9 +83,10 @@ static int mx35lf1ge4ab_ecc_get_status(struct spinand_device *spinand,
>  		 * in order to avoid forcing the wear-leveling layer to move
>  		 * data around if it's not necessary.
>  		 */
> -		if (mx35lf1ge4ab_get_eccsr(spinand, &eccsr))
> +		if (mx35lf1ge4ab_get_eccsr(spinand, spinand->scratchbuf))
>  			return nanddev_get_ecc_conf(nand)->strength;
>  
> +		eccsr = *spinand->scratchbuf;
>  		if (WARN_ON(eccsr > nanddev_get_ecc_conf(nand)->strength ||
>  			    !eccsr))
>  			return nanddev_get_ecc_conf(nand)->strength;


Thanks,
Miquèl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ