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:	Fri, 25 Sep 2015 19:34:42 +0200
From:	Richard Weinberger <richard@....at>
To:	Boris Brezillon <boris.brezillon@...e-electrons.com>,
	David Woodhouse <dwmw2@...radead.org>,
	Brian Norris <computersforpeace@...il.com>,
	linux-mtd@...ts.infradead.org,
	Artem Bityutskiy <dedekind1@...il.com>
Cc:	Andrea Scian <rnd4@...e-tech.it>,
	Bean Huo 霍斌斌 (beanhuo) 
	<beanhuo@...ron.com>,
	Karl Zhang 张双锣 (karlzhang) 
	<karlzhang@...ron.com>,
	Iwo Mergler <Iwo.Mergler@...commwireless.com>,
	"Jeff Lauruhn (jlauruhn)" <jlauruhn@...ron.com>,
	Stefan Roese <sr@...x.de>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 3/5] UBI: switch the UBI device in read-only mode when mtd
 returns -EROFS

Am 25.09.2015 um 17:09 schrieb Boris Brezillon:
> The NAND layer is now able to forward power-cut emulation errors from
> a NAND driver to the MTD user.
> Check for this kind of errors in UBI and switch the UBI device in read-only
> mode if such an error occurs.
> The error will also be forwarded to the UBI user requesting the operation
> if any, thus allowing UBIFS to act accordingly.
> 
> Signed-off-by: Boris Brezillon <boris.brezillon@...e-electrons.com>
> ---
>  drivers/mtd/ubi/io.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/mtd/ubi/io.c b/drivers/mtd/ubi/io.c
> index 5bbd1f0..c5ebef7 100644
> --- a/drivers/mtd/ubi/io.c
> +++ b/drivers/mtd/ubi/io.c
> @@ -303,6 +303,8 @@ int ubi_io_write(struct ubi_device *ubi, const void *buf, int pnum, int offset,
>  		len = ubi->peb_size - offset;
>  		if (len)
>  			err = ubi_self_check_all_ff(ubi, pnum, offset, len);
> +	} else if (err == -EROFS) {
> +		ubi_ro_mode(ubi);
>  	}
>  
>  	return err;
> @@ -355,7 +357,7 @@ retry:
>  
>  	err = mtd_erase(ubi->mtd, &ei);
>  	if (err) {
> -		if (retries++ < UBI_IO_RETRIES) {
> +		if (err != -EROFS && retries++ < UBI_IO_RETRIES) {

Looks good! :)
One small nit, can you please add a comment above both lines that the EROFS checks are
here because of emulators.

Thanks,
//richard
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ