Commit aea05eb5 authored by Anton Ivanov's avatar Anton Ivanov Committed by Richard Weinberger
Browse files

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: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarAnton Ivanov <anton.ivanov@cambridgegreys.com>
Signed-off-by: default avatarRichard Weinberger <richard@nod.at>
parent df20af1e
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -938,7 +938,7 @@ static int ubd_add(int n, char **error_out)
	ubd_dev->queue = blk_mq_init_queue(&ubd_dev->tag_set);
	if (IS_ERR(ubd_dev->queue)) {
		err = PTR_ERR(ubd_dev->queue);
		goto out_cleanup;
		goto out_cleanup_tags;
	}

	ubd_dev->queue->queuedata = ubd_dev;
@@ -968,7 +968,7 @@ out:

out_cleanup_tags:
	blk_mq_free_tag_set(&ubd_dev->tag_set);
out_cleanup:
	if (!(IS_ERR(ubd_dev->queue)))
		blk_cleanup_queue(ubd_dev->queue);
	goto out;
}