提交 78a8dfba 编写于 作者: R Romain Izard 提交者: Richard Weinberger

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: 9d54c8a3 (UBI: R/O block driver on top of UBI volumes)
Signed-off-by: NRomain Izard <romain.izard.pro@gmail.com>
Signed-off-by: NRichard Weinberger <richard@nod.at>
上级 29b7a6fa
...@@ -244,7 +244,7 @@ static int ubiblock_open(struct block_device *bdev, fmode_t mode) ...@@ -244,7 +244,7 @@ static int ubiblock_open(struct block_device *bdev, fmode_t mode)
* in any case. * in any case.
*/ */
if (mode & FMODE_WRITE) { if (mode & FMODE_WRITE) {
ret = -EPERM; ret = -EROFS;
goto out_unlock; goto out_unlock;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册