* [PATCH 3/3] nvme-fc: fix module_init (theoretical) error path
@ 2017-03-19 12:22 Sagi Grimberg
2017-03-21 11:31 ` James Smart
2017-03-27 9:52 ` Christoph Hellwig
0 siblings, 2 replies; 3+ messages in thread
From: Sagi Grimberg @ 2017-03-19 12:22 UTC (permalink / raw)
If nvmf_register_transport happened to fail
(it can't, but theoretically) we leak memory.
Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
---
drivers/nvme/host/fc.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
index 9690beb15e69..f77cdcf51e65 100644
--- a/drivers/nvme/host/fc.c
+++ b/drivers/nvme/host/fc.c
@@ -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)
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 3/3] nvme-fc: fix module_init (theoretical) error path
2017-03-19 12:22 [PATCH 3/3] nvme-fc: fix module_init (theoretical) error path Sagi Grimberg
@ 2017-03-21 11:31 ` James Smart
2017-03-27 9:52 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: James Smart @ 2017-03-21 11:31 UTC (permalink / raw)
looks fine
thanks
-- james
Signed-off-by: James Smart <james.smart at broadcom.com>
On 3/19/2017 5:22 AM, Sagi Grimberg wrote:
> If nvmf_register_transport happened to fail
> (it can't, but theoretically) we leak memory.
>
> Signed-off-by: Sagi Grimberg <sagi at grimberg.me>
> ---
> drivers/nvme/host/fc.c | 11 ++++++++++-
> 1 file changed, 10 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/nvme/host/fc.c b/drivers/nvme/host/fc.c
> index 9690beb15e69..f77cdcf51e65 100644
> --- a/drivers/nvme/host/fc.c
> +++ b/drivers/nvme/host/fc.c
> @@ -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)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 3/3] nvme-fc: fix module_init (theoretical) error path
2017-03-19 12:22 [PATCH 3/3] nvme-fc: fix module_init (theoretical) error path Sagi Grimberg
2017-03-21 11:31 ` James Smart
@ 2017-03-27 9:52 ` Christoph Hellwig
1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2017-03-27 9:52 UTC (permalink / raw)
Looks fine,
Reviewed-by: Christoph Hellwig <hch at lst.de>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-27 9:52 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-19 12:22 [PATCH 3/3] nvme-fc: fix module_init (theoretical) error path Sagi Grimberg
2017-03-21 11:31 ` James Smart
2017-03-27 9:52 ` Christoph Hellwig
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.