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: <20230328145848.5c7e4f14@xps-13>
Date:   Tue, 28 Mar 2023 14:58:48 +0200
From:   Miquel Raynal <miquel.raynal@...tlin.com>
To:     Bang Li <libang.linuxer@...il.com>
Cc:     richard@....at, vigneshr@...com, linux-mtd@...ts.infradead.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mtdblock: tolerate corrected bit-flips

Hello,

libang.linuxer@...il.com wrote on Thu, 23 Mar 2023 22:03:50 +0800:

> mtd_read() may return -EUCLEAN in case of corrected bit-flips.This
> particular condition should not be treated like an error.

I'm fine with the patch, Richard, are you okay as well?

> Signed-off-by: Bang Li <libang.linuxer@...il.com>
> ---
>  drivers/mtd/mtdblock.c | 12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c
> index 1e94e7d10b8b..a0a1194dc1d9 100644
> --- a/drivers/mtd/mtdblock.c
> +++ b/drivers/mtd/mtdblock.c
> @@ -153,7 +153,7 @@ static int do_cached_write (struct mtdblk_dev *mtdblk, unsigned long pos,
>  				mtdblk->cache_state = STATE_EMPTY;
>  				ret = mtd_read(mtd, sect_start, sect_size,
>  					       &retlen, mtdblk->cache_data);
> -				if (ret)
> +				if (ret && !mtd_is_bitflip(ret))
>  					return ret;
>  				if (retlen != sect_size)
>  					return -EIO;
> @@ -188,8 +188,12 @@ static int do_cached_read (struct mtdblk_dev *mtdblk, unsigned long pos,
>  	pr_debug("mtdblock: read on \"%s\" at 0x%lx, size 0x%x\n",
>  			mtd->name, pos, len);
>  
> -	if (!sect_size)
> -		return mtd_read(mtd, pos, len, &retlen, buf);
> +	if (!sect_size) {
> +		ret = mtd_read(mtd, pos, len, &retlen, buf);
> +		if (ret && !mtd_is_bitflip(ret))
> +			return ret;
> +		return 0;
> +	}
>  
>  	while (len > 0) {
>  		unsigned long sect_start = (pos/sect_size)*sect_size;
> @@ -209,7 +213,7 @@ static int do_cached_read (struct mtdblk_dev *mtdblk, unsigned long pos,
>  			memcpy (buf, mtdblk->cache_data + offset, size);
>  		} else {
>  			ret = mtd_read(mtd, pos, size, &retlen, buf);
> -			if (ret)
> +			if (ret && !mtd_is_bitflip(ret))
>  				return ret;
>  			if (retlen != size)
>  				return -EIO;


Thanks,
Miquèl

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ