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 <hch@lst.de> Fixes: 2d786e6 ("block: ublk: switch to ioctl command encoding") Signed-off-by: Ming Lei <ming.lei@redhat.com> Link: https://lore.kernel.org/r/20230420091104.1092972-1-ming.lei@redhat.com Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 9e05a25 commit 7c75661

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

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)