Skip to content

Commit 53e7d08

Browse files
Ming Leiaxboe
authored andcommitted
ublk: fail to start device if queue setup is interrupted
In ublk_ctrl_start_dev(), if wait_for_completion_interruptible() is interrupted by signal, queues aren't setup successfully yet, so we have to fail UBLK_CMD_START_DEV, otherwise kernel oops can be triggered. Reported by German when working on qemu-storage-deamon which requires single thread ublk daemon. Fixes: 71f28f3 ("ublk_drv: add io_uring based userspace block driver") Reported-by: German Maglione <[email protected]> Signed-off-by: Ming Lei <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent e0933b5 commit 53e7d08

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/block/ublk_drv.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1847,7 +1847,8 @@ static int ublk_ctrl_start_dev(struct ublk_device *ub, struct io_uring_cmd *cmd)
18471847
if (ublksrv_pid <= 0)
18481848
return -EINVAL;
18491849

1850-
wait_for_completion_interruptible(&ub->completion);
1850+
if (wait_for_completion_interruptible(&ub->completion) != 0)
1851+
return -EINTR;
18511852

18521853
schedule_delayed_work(&ub->monitor_work, UBLK_DAEMON_MONITOR_PERIOD);
18531854

0 commit comments

Comments
 (0)