2014-11-30 11:00:53

by Lino Sanfilippo

[permalink] [raw]
Subject: [PATCH] iscsi-target: fix error path in iscsi_target_init_module()

In iscsi_target_init_module() unwind transport protocol registration in case
that iscsit_load_discovery_tpg() failed.

Signed-off-by: Lino Sanfilippo <[email protected]>
---
drivers/target/iscsi/iscsi_target.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
index 73e58d2..f8ec322 100644
--- a/drivers/target/iscsi/iscsi_target.c
+++ b/drivers/target/iscsi/iscsi_target.c
@@ -609,6 +609,7 @@ static int __init iscsi_target_init_module(void)

return ret;
r2t_out:
+ iscsit_unregister_transport(&iscsi_target_transport);
kmem_cache_destroy(lio_r2t_cache);
ooo_out:
kmem_cache_destroy(lio_ooo_cache);
--
1.9.1


2014-11-30 16:31:02

by Sagi Grimberg

[permalink] [raw]
Subject: Re: [PATCH] iscsi-target: fix error path in iscsi_target_init_module()

On 11/30/2014 1:00 PM, Lino Sanfilippo wrote:
> In iscsi_target_init_module() unwind transport protocol registration in case
> that iscsit_load_discovery_tpg() failed.
>
> Signed-off-by: Lino Sanfilippo <[email protected]>
> ---
> drivers/target/iscsi/iscsi_target.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
> index 73e58d2..f8ec322 100644
> --- a/drivers/target/iscsi/iscsi_target.c
> +++ b/drivers/target/iscsi/iscsi_target.c
> @@ -609,6 +609,7 @@ static int __init iscsi_target_init_module(void)
>
> return ret;
> r2t_out:
> + iscsit_unregister_transport(&iscsi_target_transport);
> kmem_cache_destroy(lio_r2t_cache);
> ooo_out:
> kmem_cache_destroy(lio_ooo_cache);
>

Yep, Looks good.

Reviewed-by: Sagi Grimberg <[email protected]>

2014-12-02 06:12:18

by Nicholas A. Bellinger

[permalink] [raw]
Subject: Re: [PATCH] iscsi-target: fix error path in iscsi_target_init_module()

On Sun, 2014-11-30 at 12:00 +0100, Lino Sanfilippo wrote:
> In iscsi_target_init_module() unwind transport protocol registration in case
> that iscsit_load_discovery_tpg() failed.
>
> Signed-off-by: Lino Sanfilippo <[email protected]>
> ---
> drivers/target/iscsi/iscsi_target.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/target/iscsi/iscsi_target.c b/drivers/target/iscsi/iscsi_target.c
> index 73e58d2..f8ec322 100644
> --- a/drivers/target/iscsi/iscsi_target.c
> +++ b/drivers/target/iscsi/iscsi_target.c
> @@ -609,6 +609,7 @@ static int __init iscsi_target_init_module(void)
>
> return ret;
> r2t_out:
> + iscsit_unregister_transport(&iscsi_target_transport);
> kmem_cache_destroy(lio_r2t_cache);
> ooo_out:
> kmem_cache_destroy(lio_ooo_cache);

Nice catch. Applied to target-pending/for-next.

Thanks Lino!

--nab