Commit 08ff089b authored by Roi Dayan's avatar Roi Dayan Committed by Doug Ledford

IB/iser: Fix module init not cleaning up on error flow

Destroy workqueue on transport register error, also
release kmem cache on workqueue allocation error.
Signed-off-by: default avatarRoi Dayan <roid@mellanox.com>
Signed-off-by: default avatarSagi Grimberg <sagig@mellanox.com>
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 46e741f4
...@@ -1059,7 +1059,8 @@ static int __init iser_init(void) ...@@ -1059,7 +1059,8 @@ static int __init iser_init(void)
release_wq = alloc_workqueue("release workqueue", 0, 0); release_wq = alloc_workqueue("release workqueue", 0, 0);
if (!release_wq) { if (!release_wq) {
iser_err("failed to allocate release workqueue\n"); iser_err("failed to allocate release workqueue\n");
return -ENOMEM; err = -ENOMEM;
goto err_alloc_wq;
} }
iscsi_iser_scsi_transport = iscsi_register_transport( iscsi_iser_scsi_transport = iscsi_register_transport(
...@@ -1067,12 +1068,14 @@ static int __init iser_init(void) ...@@ -1067,12 +1068,14 @@ static int __init iser_init(void)
if (!iscsi_iser_scsi_transport) { if (!iscsi_iser_scsi_transport) {
iser_err("iscsi_register_transport failed\n"); iser_err("iscsi_register_transport failed\n");
err = -EINVAL; err = -EINVAL;
goto register_transport_failure; goto err_reg;
} }
return 0; return 0;
register_transport_failure: err_reg:
destroy_workqueue(release_wq);
err_alloc_wq:
kmem_cache_destroy(ig.desc_cache); kmem_cache_destroy(ig.desc_cache);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment