diff options
author | Sagi Grimberg <sagi@grimberg.me> | 2017-03-19 05:21:42 +0100 |
---|---|---|
committer | Jens Axboe <axboe@fb.com> | 2017-04-04 17:48:23 +0200 |
commit | a56c79cfd3e97706ad5615831c3bab01fb4047c4 (patch) | |
tree | e3c68a43172d20a387662abcf0cf2679d582b5b3 /drivers/nvme | |
parent | nvmet: use symbolic constants for log identifiers (diff) | |
download | linux-a56c79cfd3e97706ad5615831c3bab01fb4047c4.tar.xz linux-a56c79cfd3e97706ad5615831c3bab01fb4047c4.zip |
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/nvme')
-rw-r--r-- | drivers/nvme/host/rdma.c | 18 |
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) |