Skip to content

Commit 7c75661

Browse files
Ming Leiaxboe
authored andcommitted
ublk: don't return 0 in case of any failure
Commit 2d786e6 ("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: 2d786e6 ("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]>
1 parent 9e05a25 commit 7c75661

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

drivers/block/ublk_drv.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1315,6 +1315,7 @@ static int ublk_ch_uring_cmd(struct io_uring_cmd *cmd, unsigned int issue_flags)
13151315
if (ret)
13161316
goto out;
13171317

1318+
ret = -EINVAL;
13181319
switch (_IOC_NR(cmd_op)) {
13191320
case UBLK_IO_FETCH_REQ:
13201321
/* UBLK_IO_FETCH_REQ is only allowed before queue is setup */

0 commit comments

Comments
 (0)