From: Romain Izard Date: Mon, 29 Jan 2018 10:18:20 +0000 (+0100) Subject: ubi: Fix error for write access X-Git-Tag: v4.19~1226^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=78a8dfbabbece22bee58ac4cb26cab10e7a19c5d;p=platform%2Fkernel%2Flinux-rpi.git ubi: Fix error for write access 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 Signed-off-by: Richard Weinberger --- diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c index b1fc28f..d0b63bbf 100644 --- a/drivers/mtd/ubi/block.c +++ b/drivers/mtd/ubi/block.c @@ -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; }