Skip to content

Commit 7ade852

Browse files
romain-izard-progregkh
authored andcommitted
ubi: Fix error for write access
commit 78a8dfb upstream. 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: [email protected] Fixes: 9d54c8a (UBI: R/O block driver on top of UBI volumes) Signed-off-by: Romain Izard <[email protected]> Signed-off-by: Richard Weinberger <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent bf3fbf5 commit 7ade852

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/mtd/ubi/block.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ static int ubiblock_open(struct block_device *bdev, fmode_t mode)
244244
* in any case.
245245
*/
246246
if (mode & FMODE_WRITE) {
247-
ret = -EPERM;
247+
ret = -EROFS;
248248
goto out_unlock;
249249
}
250250

0 commit comments

Comments
 (0)