Skip to content

Commit 0c0cbd4

Browse files
Ming Leiaxboe
authored andcommitted
ublk: fail to recover device if queue setup is interrupted
In ublk_ctrl_end_recovery(), if wait_for_completion_interruptible() is interrupted by signal, queues aren't setup successfully yet, so we have to fail UBLK_CMD_END_USER_RECOVERY, otherwise kernel oops can be triggered. Fixes: c732a85 ("ublk_drv: add START_USER_RECOVERY and END_USER_RECOVERY support") Reported-by: Stefano Garzarella <[email protected]> Signed-off-by: Ming Lei <[email protected]> Reviewed-by: Stefano Garzarella <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 53e7d08 commit 0c0cbd4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/block/ublk_drv.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2324,7 +2324,9 @@ static int ublk_ctrl_end_recovery(struct ublk_device *ub,
23242324
pr_devel("%s: Waiting for new ubq_daemons(nr: %d) are ready, dev id %d...\n",
23252325
__func__, ub->dev_info.nr_hw_queues, header->dev_id);
23262326
/* wait until new ubq_daemon sending all FETCH_REQ */
2327-
wait_for_completion_interruptible(&ub->completion);
2327+
if (wait_for_completion_interruptible(&ub->completion))
2328+
return -EINTR;
2329+
23282330
pr_devel("%s: All new ubq_daemons(nr: %d) are ready, dev id %d\n",
23292331
__func__, ub->dev_info.nr_hw_queues, header->dev_id);
23302332

0 commit comments

Comments
 (0)