summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorSagi Grimberg <sagi@grimberg.me>2017-03-19 06:21:42 +0200
committerJens Axboe <axboe@fb.com>2017-04-04 09:48:23 -0600
commita56c79cfd3e97706ad5615831c3bab01fb4047c4 (patch)
treee3c68a43172d20a387662abcf0cf2679d582b5b3 /drivers
parent2ca0786d5a66b919acac865b11b51df43f9457a2 (diff)
downloadlinux-a56c79cfd3e97706ad5615831c3bab01fb4047c4.tar.bz2
nvme-rdma: fix module_init (theoretical) error path
If nvmf_register_transport happened to fail (it can't, but theoretically) we leak memory. Signed-off-by: Sagi Grimberg <sagi@grimberg.me> Signed-off-by: Jens Axboe <axboe@fb.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/nvme/host/rdma.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
index 15eb34c1c436..8592adac4747 100644
--- a/drivers/nvme/host/rdma.c
+++ b/drivers/nvme/host/rdma.c
@@ -2030,12 +2030,20 @@ static int __init nvme_rdma_init_module(void)
return -ENOMEM;
ret = ib_register_client(&nvme_rdma_ib_client);
- if (ret) {
- destroy_workqueue(nvme_rdma_wq);
- return ret;
- }
+ if (ret)
+ goto err_destroy_wq;
+
+ ret = nvmf_register_transport(&nvme_rdma_transport);
+ if (ret)
+ goto err_unreg_client;
- return nvmf_register_transport(&nvme_rdma_transport);
+ return 0;
+
+err_unreg_client:
+ ib_unregister_client(&nvme_rdma_ib_client);
+err_destroy_wq:
+ destroy_workqueue(nvme_rdma_wq);
+ return ret;
}
static void __exit nvme_rdma_cleanup_module(void)