提交 c0e4a6f5 编写于 作者: S Sagi Grimberg 提交者: Jens Axboe

nvme-fc: fix module_init (theoretical) error path

If nvmf_register_transport happened to fail
(it can't, but theoretically) we leak memory.
Signed-off-by: NSagi Grimberg <sagi@grimberg.me>
Signed-off-by: NJens Axboe <axboe@fb.com>
上级 d19eef02
......@@ -2546,11 +2546,20 @@ static struct nvmf_transport_ops nvme_fc_transport = {
static int __init nvme_fc_init_module(void)
{
int ret;
nvme_fc_wq = create_workqueue("nvme_fc_wq");
if (!nvme_fc_wq)
return -ENOMEM;
return nvmf_register_transport(&nvme_fc_transport);
ret = nvmf_register_transport(&nvme_fc_transport);
if (ret)
goto err;
return 0;
err:
destroy_workqueue(nvme_fc_wq);
return ret;
}
static void __exit nvme_fc_exit_module(void)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册