[PATCH] ublk: fix command op code check

Subsystems: block layer, the rest, ublk userspace block driver

STALE1257d LANDED

Landed in mainline as e485bd9e2c41 on 2023-05-12.

4 messages, 2 authors, 2023-05-12 · open the first message on its own page

[PATCH] ublk: fix command op code check

From: Ming Lei <hidden>
Date: 2023-05-05 15:32:55

In case of CONFIG_BLKDEV_UBLK_LEGACY_OPCODES, type of cmd opcode could
be 0 or 'u'; and type can only be 'u' if CONFIG_BLKDEV_UBLK_LEGACY_OPCODES
isn't set.

So fix the wrong check.

Fixes: 2d786e66c966 ("block: ublk: switch to ioctl command encoding")
Signed-off-by: Ming Lei <redacted>
---
 drivers/block/ublk_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c
index 72a5cde9a5af..92cb2eb384f2 100644
--- a/drivers/block/ublk_drv.c
+++ b/drivers/block/ublk_drv.c
@@ -1281,7 +1281,7 @@ static inline int ublk_check_cmd_op(u32 cmd_op)
 {
 	u32 ioc_type = _IOC_TYPE(cmd_op);
 
-	if (IS_ENABLED(CONFIG_BLKDEV_UBLK_LEGACY_OPCODES) && ioc_type != 'u')
+	if (!IS_ENABLED(CONFIG_BLKDEV_UBLK_LEGACY_OPCODES) && ioc_type != 'u')
 		return -EOPNOTSUPP;
 
 	if (ioc_type != 'u' && ioc_type != 0)
-- 
2.38.1

Re: [PATCH] ublk: fix command op code check

From: Ming Lei <hidden>
Date: 2023-05-12 15:09:32

On Fri, May 05, 2023 at 11:31:42PM +0800, Ming Lei wrote:
In case of CONFIG_BLKDEV_UBLK_LEGACY_OPCODES, type of cmd opcode could
be 0 or 'u'; and type can only be 'u' if CONFIG_BLKDEV_UBLK_LEGACY_OPCODES
isn't set.

So fix the wrong check.

Fixes: 2d786e66c966 ("block: ublk: switch to ioctl command encoding")
Signed-off-by: Ming Lei <redacted>
Hello Jens,

Can you queue this fix for 6.3?


Thanks,
Ming

Re: [PATCH] ublk: fix command op code check

From: Jens Axboe <axboe@kernel.dk>
Date: 2023-05-12 15:09:32

On 5/12/23 9:08 AM, Ming Lei wrote:
On Fri, May 05, 2023 at 11:31:42PM +0800, Ming Lei wrote:
quoted
In case of CONFIG_BLKDEV_UBLK_LEGACY_OPCODES, type of cmd opcode could
be 0 or 'u'; and type can only be 'u' if CONFIG_BLKDEV_UBLK_LEGACY_OPCODES
isn't set.

So fix the wrong check.

Fixes: 2d786e66c966 ("block: ublk: switch to ioctl command encoding")
Signed-off-by: Ming Lei <redacted>
Hello Jens,

Can you queue this fix for 6.3?
Done, for 6.4 though.

-- 
Jens Axboe

Re: [PATCH] ublk: fix command op code check

From: Jens Axboe <axboe@kernel.dk>
Date: 2023-05-12 15:09:51

On Fri, 05 May 2023 23:31:42 +0800, Ming Lei wrote:
In case of CONFIG_BLKDEV_UBLK_LEGACY_OPCODES, type of cmd opcode could
be 0 or 'u'; and type can only be 'u' if CONFIG_BLKDEV_UBLK_LEGACY_OPCODES
isn't set.

So fix the wrong check.


[...]
Applied, thanks!

[1/1] ublk: fix command op code check
      commit: e485bd9e2c419142430ae6fe3e8f64e3059aef50

Best regards,
-- 
Jens Axboe


Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help