From: Josef Bacik Date: Wed, 15 Feb 2017 21:49:48 +0000 (-0500) Subject: nbd: cleanup workqueue on error properly X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=6330a2d0b465527d621a9d95cad6b2fc0a959f13;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git nbd: cleanup workqueue on error properly If we fail to register the blockdev we need to make sure to destroy the recv workqueue. Signed-off-by: Josef Bacik Signed-off-by: Jens Axboe --- diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index cdbeb309a105..0bf2b21a62cb 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -1121,8 +1121,10 @@ static int __init nbd_init(void) if (!recv_workqueue) return -ENOMEM; - if (register_blkdev(NBD_MAJOR, "nbd")) + if (register_blkdev(NBD_MAJOR, "nbd")) { + destroy_workqueue(recv_workqueue); return -EIO; + } nbd_dbg_init();