From: Bart Van Assche Date: Thu, 27 Apr 2017 17:11:19 +0000 (-0700) Subject: dm rq: check blk_mq_register_dev() return value in dm_mq_init_request_queue() X-Git-Tag: MMI-PSA29.97-13-9~5705^2~9 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=23a601248958fa4142d49294352fe8d1fdf3e509;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git dm rq: check blk_mq_register_dev() return value in dm_mq_init_request_queue() Otherwise the request-based DM blk-mq request_queue will be put into service without being properly exported via sysfs. Cc: stable@vger.kernel.org Signed-off-by: Bart Van Assche Reviewed-by: Hannes Reinecke Cc: Christoph Hellwig Signed-off-by: Mike Snitzer --- diff --git a/drivers/md/dm-rq.c b/drivers/md/dm-rq.c index 90756a56c4d3..a6e8da9da7a4 100644 --- a/drivers/md/dm-rq.c +++ b/drivers/md/dm-rq.c @@ -809,10 +809,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: