diff options
author | Ming Lei <[email protected]> | 2023-04-20 17:11:04 +0800 |
---|---|---|
committer | Jens Axboe <[email protected]> | 2023-04-20 07:03:02 -0600 |
commit | 7c75661c42a06fe35e1774373194f646b5a9e5c9 (patch) | |
tree | 92df6a1e0da2158c25d08412cce1223ab40db2b3 | |
parent | 9e05a2599a37295eb2dc5c03441daa6741abed4b (diff) |
ublk: don't return 0 in case of any failure
Commit 2d786e66c966 ("block: ublk: switch to ioctl command encoding")
starts to reset local variable of 'ret' as zero, then if any failure
happens when handling the three IO commands, 0 can be returned to ublk
server.
Fix it by returning -EINVAL in case of command handling failure.
Cc: Christoph Hellwig <[email protected]>
Fixes: 2d786e66c966 ("block: ublk: switch to ioctl command encoding")
Signed-off-by: Ming Lei <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
-rw-r--r-- | drivers/block/ublk_drv.c | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/block/ublk_drv.c b/drivers/block/ublk_drv.c index 5da5876a4443..253008b2091d 100644 --- a/drivers/block/ublk_drv.c +++ b/drivers/block/ublk_drv.c @@ -1315,6 +1315,7 @@ static int ublk_ch_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags) if (ret) goto out; + ret = -EINVAL; switch (_IOC_NR(cmd_op)) { case UBLK_IO_FETCH_REQ: /* UBLK_IO_FETCH_REQ is only allowed before queue is setup */ |