Skip to contentSkip to conversation

nbd: cleanup workqueue on error properly

PATCH New Josef Bacik 1 participant 1 message Feb 15, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 nbd: cleanup workqueue on error properly

If we fail to register the blockdev we need to make sure to destroy the recv workqueue.

---
 drivers/block/nbd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/block/nbd.c +3 -1
index 0623f8f..a032a00 100644
@@ -1271,8 +1271,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();
 
Signature · 1 line
2.7.4