Browse Source

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 <jbacik@fb.com>
Signed-off-by: Jens Axboe <axboe@fb.com>
Josef Bacik 8 years ago
parent
commit
6330a2d0b4
1 changed files with 3 additions and 1 deletions
  1. 3 1
      drivers/block/nbd.c

+ 3 - 1
drivers/block/nbd.c

@@ -1121,8 +1121,10 @@ static int __init nbd_init(void)
 	if (!recv_workqueue)
 	if (!recv_workqueue)
 		return -ENOMEM;
 		return -ENOMEM;
 
 
-	if (register_blkdev(NBD_MAJOR, "nbd"))
+	if (register_blkdev(NBD_MAJOR, "nbd")) {
+		destroy_workqueue(recv_workqueue);
 		return -EIO;
 		return -EIO;
+	}
 
 
 	nbd_dbg_init();
 	nbd_dbg_init();