Skip to content

Commit aea05eb

Browse files
kot-begemot-ukrichardweinberger
authored andcommitted
um: Fix for a possible OOPS in ubd initialization
If the ubd device failed to allocate a queue during initialization it tried call blk_cleanup_queue resulting in an oops. This patch simplifies the cleanup logic and ensures that blk_queue_cleanup is called only if there is a valid queue. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: Anton Ivanov <anton.ivanov@cambridgegreys.com> Signed-off-by: Richard Weinberger <richard@nod.at>
1 parent df20af1 commit aea05eb

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/um/drivers/ubd_kern.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -938,7 +938,7 @@ static int ubd_add(int n, char **error_out)
938938
ubd_dev->queue = blk_mq_init_queue(&ubd_dev->tag_set);
939939
if (IS_ERR(ubd_dev->queue)) {
940940
err = PTR_ERR(ubd_dev->queue);
941-
goto out_cleanup;
941+
goto out_cleanup_tags;
942942
}
943943

944944
ubd_dev->queue->queuedata = ubd_dev;
@@ -968,8 +968,8 @@ static int ubd_add(int n, char **error_out)
968968

969969
out_cleanup_tags:
970970
blk_mq_free_tag_set(&ubd_dev->tag_set);
971-
out_cleanup:
972-
blk_cleanup_queue(ubd_dev->queue);
971+
if (!(IS_ERR(ubd_dev->queue)))
972+
blk_cleanup_queue(ubd_dev->queue);
973973
goto out;
974974
}
975975

0 commit comments

Comments
 (0)