]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
ubi: Fix error for write access
authorRomain Izard <romain.izard.pro@gmail.com>
Mon, 29 Jan 2018 10:18:20 +0000 (11:18 +0100)
committerSasha Levin <alexander.levin@microsoft.com>
Wed, 23 May 2018 01:36:32 +0000 (21:36 -0400)
commit7f6d92e7f0527cb5e0c041c861d01cb25de3bb11
treecff5a74bc3a195300fdc99909637728fc5003943
parent57f6a9712fcd8f88f3dab816baaea7b695327dcd
ubi: Fix error for write access

[ Upstream commit 78a8dfbabbece22bee58ac4cb26cab10e7a19c5d ]

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>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
drivers/mtd/ubi/block.c