]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
ubi: Fix error for write access
authorRomain Izard <romain.izard.pro@gmail.com>
Mon, 29 Jan 2018 10:18:20 +0000 (11:18 +0100)
committerRichard Weinberger <richard@nod.at>
Wed, 4 Apr 2018 21:48:05 +0000 (23:48 +0200)
When opening a device with write access, ubiblock_open returns an error
code. Currently, this error code is -EPERM, but this is not the right
value.

The open function for other block devices returns -EROFS when opening
read-only devices with FMODE_WRITE set. When used with dm-verity, the
veritysetup userspace tool is expecting EROFS, and refuses to use the
ubiblock device.

Use -EROFS for ubiblock as well. As a result, veritysetup accepts the
ubiblock device as valid.

Cc: stable@vger.kernel.org
Fixes: 9d54c8a33eec (UBI: R/O block driver on top of UBI volumes)
Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
drivers/mtd/ubi/block.c

index b1fc28f63882e75125230d05462b775cb18732f7..d0b63bbf46a792e3d168606b6dd102b7bb0c9079 100644 (file)
@@ -244,7 +244,7 @@ static int ubiblock_open(struct block_device *bdev, fmode_t mode)
         * in any case.
         */
        if (mode & FMODE_WRITE) {
-               ret = -EPERM;
+               ret = -EROFS;
                goto out_unlock;
        }