Skip to contentSkip to conversation

ublk: fix command op code check

PATCH Applied Ming Lei 2 participants 4 messages May 5, 2023 – May 12, 2023

Subsystems (2)
lore
Share & tools
lore

Ming Lei

author
#0 lore raw

PATCH 1/1 ublk: fix command op code check

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")
---
 drivers/block/ublk_drv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/block/ublk_drv.c +1 -1
index 72a5cde9a5af..92cb2eb384f2 100644
@@ -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)
Signature · 1 line
2.38.1
author
#1 lore raw
Quoted 8 lines · Ming Lei

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")

Hello Jens,

Can you queue this fix for 6.3?

Thanks,
Ming

maintainer
#2 lore raw
Quoted 5 lines · Ming Lei
Quoted 4 lines · Ming Lei

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.

Quoted 8 lines
Quoted 4 lines

So fix the wrong check.

Fixes 2d786e66c966 ("block: ublk: switch to ioctl command encoding")

Hello Jens,

Can you queue this fix for 6.3?

Done, for 6.4 though.

Signature · 1 line
Jens Axboe
maintainer Applied
#3 lore raw
In reply to Ming Lei
Quoted 8 lines · Ming Lei

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,

Signature · 1 line
Jens Axboe