summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@sandisk.com>2017-04-27 10:11:19 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-05-20 14:28:37 +0200
commitf32e35bc3d542cb53a4226cca5ac803dc4dbe892 (patch)
treea007528d94a76c74c645b6faa34b49c6808313b5
parentf6ec18eb7425a334689584fcf5849107858fbd25 (diff)
downloadlinux-stable-f32e35bc3d542cb53a4226cca5ac803dc4dbe892.tar.gz
linux-stable-f32e35bc3d542cb53a4226cca5ac803dc4dbe892.tar.bz2
linux-stable-f32e35bc3d542cb53a4226cca5ac803dc4dbe892.zip
dm rq: check blk_mq_register_dev() return value in dm_mq_init_request_queue()
commit 23a601248958fa4142d49294352fe8d1fdf3e509 upstream. Otherwise the request-based DM blk-mq request_queue will be put into service without being properly exported via sysfs. Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Reviewed-by: Hannes Reinecke <hare@suse.com> Cc: Christoph Hellwig <hch@lst.de> Signed-off-by: Mike Snitzer <snitzer@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--drivers/md/dm-rq.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c
index 2c965424d383..ba7c4c685db3 100644
--- a/drivers/md/dm-rq.c
+++ b/drivers/md/dm-rq.c
@@ -997,10 +997,14 @@ int dm_mq_init_request_queue(struct mapped_device *md, struct dm_table *t)
dm_init_md_queue(md);
/* backfill 'mq' sysfs registration normally done in blk_register_queue */
- blk_mq_register_dev(disk_to_dev(md->disk), q);
+ err = blk_mq_register_dev(disk_to_dev(md->disk), q);
+ if (err)
+ goto out_cleanup_queue;
return 0;
+out_cleanup_queue:
+ blk_cleanup_queue(q);
out_tag_set:
blk_mq_free_tag_set(md->tag_set);
out_kfree_tag_set: