summaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authortangwenji <tang.wenji@zte.com.cn>2017-09-15 16:03:13 +0800
committerNicholas Bellinger <nab@linux-iscsi.org>2017-11-04 14:45:25 -0700
commit12d5a43b2dffb6cd28062b4e19024f7982393288 (patch)
treebb16b67d47cd84a6b8f3aaa480bff73e45025e54 /drivers/target
parent24528f089d0a444070aa4f715ace537e8d6bf168 (diff)
downloadlinux-12d5a43b2dffb6cd28062b4e19024f7982393288.tar.gz
linux-12d5a43b2dffb6cd28062b4e19024f7982393288.tar.bz2
linux-12d5a43b2dffb6cd28062b4e19024f7982393288.zip
iscsi-target: fix memory leak in lio_target_tiqn_addtpg()
tpg must free when call core_tpg_register() return fail Signed-off-by: tangwenji <tang.wenji@zte.com.cn> Signed-off-by: Nicholas Bellinger <nab@linux-iscsi.org>
Diffstat (limited to 'drivers/target')
-rw-r--r--drivers/target/iscsi/iscsi_target_configfs.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/target/iscsi/iscsi_target_configfs.c b/drivers/target/iscsi/iscsi_target_configfs.c
index 0dd4c45f7575..0ebc4818e132 100644
--- a/drivers/target/iscsi/iscsi_target_configfs.c
+++ b/drivers/target/iscsi/iscsi_target_configfs.c
@@ -1123,7 +1123,7 @@ static struct se_portal_group *lio_target_tiqn_addtpg(
ret = core_tpg_register(wwn, &tpg->tpg_se_tpg, SCSI_PROTOCOL_ISCSI);
if (ret < 0)
- return NULL;
+ goto free_out;
ret = iscsit_tpg_add_portal_group(tiqn, tpg);
if (ret != 0)
@@ -1135,6 +1135,7 @@ static struct se_portal_group *lio_target_tiqn_addtpg(
return &tpg->tpg_se_tpg;
out:
core_tpg_deregister(&tpg->tpg_se_tpg);
+free_out:
kfree(tpg);
return NULL;
}