Skip to content

Commit a0884d4

Browse files
tangwenjiNicholas Bellinger
authored and
Nicholas Bellinger
committed
iscsi-target: fix memory leak in iscsit_release_discovery_tpg()
Need to release the param_list for tpg in iscsi_release_discovery_tpg function, this is also required before the iscsit_load_discovery_tpg function exits abnormally. Signed-off-by: tangwenji <tang.wenji@zte.com.cn> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
1 parent 12d5a43 commit a0884d4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/target/iscsi/iscsi_target_tpg.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ int iscsit_load_discovery_tpg(void)
9090
*/
9191
param = iscsi_find_param_from_key(AUTHMETHOD, tpg->param_list);
9292
if (!param)
93-
goto out;
93+
goto free_pl_out;
9494

9595
if (iscsi_update_param_value(param, "CHAP,None") < 0)
96-
goto out;
96+
goto free_pl_out;
9797

9898
tpg->tpg_attrib.authentication = 0;
9999

@@ -105,6 +105,8 @@ int iscsit_load_discovery_tpg(void)
105105
pr_debug("CORE[0] - Allocated Discovery TPG\n");
106106

107107
return 0;
108+
free_pl_out:
109+
iscsi_release_param_list(tpg->param_list);
108110
out:
109111
if (tpg->sid == 1)
110112
core_tpg_deregister(&tpg->tpg_se_tpg);
@@ -119,6 +121,7 @@ void iscsit_release_discovery_tpg(void)
119121
if (!tpg)
120122
return;
121123

124+
iscsi_release_param_list(tpg->param_list);
122125
core_tpg_deregister(&tpg->tpg_se_tpg);
123126

124127
kfree(tpg);

0 commit comments

Comments
 (0)