* [PATCH RESEND] mtd: ubi: block: Fix error for write access
@ 2018-03-02 11:16 Romain Izard
2018-03-02 12:21 ` Richard Weinberger
0 siblings, 1 reply; 2+ messages in thread
From: Romain Izard @ 2018-03-02 11:16 UTC (permalink / raw)
To: Artem Bityutskiy, Richard Weinberger, David Woodhouse,
Brian Norris, Boris Brezillon, Marek Vasut, Cyrille Pitchen
Cc: linux-mtd, linux-block, linux-kernel, Romain Izard
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.
Fixes: 9d54c8a33eec (UBI: R/O block driver on top of UBI volumes)
Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
---
drivers/mtd/ubi/block.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
index b210fdb31c98..4533423cf2aa 100644
--- a/drivers/mtd/ubi/block.c
+++ b/drivers/mtd/ubi/block.c
@@ -242,7 +242,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;
}
--
2.14.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH RESEND] mtd: ubi: block: Fix error for write access
2018-03-02 11:16 [PATCH RESEND] mtd: ubi: block: Fix error for write access Romain Izard
@ 2018-03-02 12:21 ` Richard Weinberger
0 siblings, 0 replies; 2+ messages in thread
From: Richard Weinberger @ 2018-03-02 12:21 UTC (permalink / raw)
To: Romain Izard
Cc: Artem Bityutskiy, David Woodhouse, Brian Norris, Boris Brezillon,
Marek Vasut, Cyrille Pitchen, linux-mtd, linux-block,
linux-kernel
Am Freitag, 2. M�rz 2018, 12:16:18 CET schrieb Romain Izard:
> 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.
>
> Fixes: 9d54c8a33eec (UBI: R/O block driver on top of UBI volumes)
> Signed-off-by: Romain Izard <romain.izard.pro@gmail.com>
> ---
> drivers/mtd/ubi/block.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/mtd/ubi/block.c b/drivers/mtd/ubi/block.c
> index b210fdb31c98..4533423cf2aa 100644
> --- a/drivers/mtd/ubi/block.c
> +++ b/drivers/mtd/ubi/block.c
> @@ -242,7 +242,7 @@ static int ubiblock_open(struct block_device *bdev,
> fmode_t mode) * in any case.
> */
> if (mode & FMODE_WRITE) {
> - ret = -EPERM;
> + ret = -EROFS;
Queued for -next.
Thanks,
//richard
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-03-02 12:20 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-02 11:16 [PATCH RESEND] mtd: ubi: block: Fix error for write access Romain Izard
2018-03-02 12:21 ` Richard Weinberger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox