ublk: fail to start device if queue setup is interrupted
authorMing Lei <ming.lei@redhat.com>
Wed, 26 Jul 2023 14:45:00 +0000 (22:45 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 3 Aug 2023 08:24:06 +0000 (10:24 +0200)
commit0d5916c439574b18a0734872daa0022b3d6105ad
tree89b56a2c07a3cf0076f5777628de394cabe89d66
parentc741076a3c76018ae41f8750fcce1b6662a61db2
ublk: fail to start device if queue setup is interrupted

[ Upstream commit 53e7d08f6d6e214c40db1f51291bb2975c789dc2 ]

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: 71f28f3136af ("ublk_drv: add io_uring based userspace block driver")
Reported-by: German Maglione <gmaglione@redhat.com>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Link: https://lore.kernel.org/r/20230726144502.566785-2-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/block/ublk_drv.c