diff options
author | Anton Ivanov <anton.ivanov@cambridgegreys.com> | 2019-02-26 10:55:25 -0500 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2019-03-06 16:39:18 -0500 |
commit | aea05eb56e47046de1e5b508d40931dca969f1e5 (patch) | |
tree | 198e7e45ab8ae97a1a6df74279e8c41133a39a29 /arch/um | |
parent | df20af1e270bb6e024d9d009516b1da864d58632 (diff) |
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>
Diffstat (limited to 'arch/um')
-rw-r--r-- | arch/um/drivers/ubd_kern.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/arch/um/drivers/ubd_kern.c b/arch/um/drivers/ubd_kern.c index a4a41421c5e2..aca09be2373e 100644 --- a/arch/um/drivers/ubd_kern.c +++ b/arch/um/drivers/ubd_kern.c | |||
@@ -938,7 +938,7 @@ static int ubd_add(int n, char **error_out) | |||
938 | ubd_dev->queue = blk_mq_init_queue(&ubd_dev->tag_set); | 938 | ubd_dev->queue = blk_mq_init_queue(&ubd_dev->tag_set); |
939 | if (IS_ERR(ubd_dev->queue)) { | 939 | if (IS_ERR(ubd_dev->queue)) { |
940 | err = PTR_ERR(ubd_dev->queue); | 940 | err = PTR_ERR(ubd_dev->queue); |
941 | goto out_cleanup; | 941 | goto out_cleanup_tags; |
942 | } | 942 | } |
943 | 943 | ||
944 | ubd_dev->queue->queuedata = ubd_dev; | 944 | ubd_dev->queue->queuedata = ubd_dev; |
@@ -968,8 +968,8 @@ out: | |||
968 | 968 | ||
969 | out_cleanup_tags: | 969 | out_cleanup_tags: |
970 | blk_mq_free_tag_set(&ubd_dev->tag_set); | 970 | blk_mq_free_tag_set(&ubd_dev->tag_set); |
971 | out_cleanup: | 971 | if (!(IS_ERR(ubd_dev->queue))) |
972 | blk_cleanup_queue(ubd_dev->queue); | 972 | blk_cleanup_queue(ubd_dev->queue); |
973 | goto out; | 973 | goto out; |
974 | } | 974 | } |
975 | 975 | ||