nbd: blk_mq_init_queue returns an error code on failure, not NULL
authorJeff Moyer <jmoyer@redhat.com>
Mon, 9 Jan 2017 20:20:31 +0000 (15:20 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 11 Aug 2017 15:49:36 +0000 (08:49 -0700)
commit952d07ac1e6e9e59267d69341c2e820710eaa718
tree9d88edf3ed16cdaea3f304db123b854b64b665b0
parent44d52834efb3d23e73a014afd8b22cfedb9a0eae
nbd: blk_mq_init_queue returns an error code on failure, not NULL

[ Upstream commit 25b4acfc7de0fc4da3bfea3a316f7282c6fbde81 ]

Additionally, don't assign directly to disk->queue, otherwise
blk_put_queue (called via put_disk) will choke (panic) on the errno
stored there.

Bug found by code inspection after Omar found a similar issue in
virtio_blk.  Compile-tested only.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>
Reviewed-by: Omar Sandoval <osandov@fb.com>
Reviewed-by: Josef Bacik <jbacik@fb.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/block/nbd.c