summaryrefslogtreecommitdiffstats
path: root/drivers/target
diff options
context:
space:
mode:
authortangwenji <tang.wenji@zte.com.cn>2017-09-15 16:03:13 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2017-12-20 10:01:32 +0100
commit75d2d7e7906c8f28bc0bbc4445de4cc750a52a3a (patch)
treeaa915fa58d907b27f5e113fcc928d5845bacbeab /drivers/target
parent8867d3f1bb32ae974c92b76529769d424d32c451 (diff)
downloadlinux-stable-75d2d7e7906c8f28bc0bbc4445de4cc750a52a3a.tar.gz
linux-stable-75d2d7e7906c8f28bc0bbc4445de4cc750a52a3a.tar.bz2
linux-stable-75d2d7e7906c8f28bc0bbc4445de4cc750a52a3a.zip
iscsi-target: fix memory leak in lio_target_tiqn_addtpg()
[ Upstream commit 12d5a43b2dffb6cd28062b4e19024f7982393288 ] 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> Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.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 bf8c6e446b68..c0bfd1624ebb 100644
--- a/drivers/target/iscsi/iscsi_target_configfs.c
+++ b/drivers/target/iscsi/iscsi_target_configfs.c
@@ -1458,7 +1458,7 @@ static struct se_portal_group *lio_target_tiqn_addtpg(
wwn, &tpg->tpg_se_tpg, tpg,
TRANSPORT_TPG_TYPE_NORMAL);
if (ret < 0)
- return NULL;
+ goto free_out;
ret = iscsit_tpg_add_portal_group(tiqn, tpg);
if (ret != 0)
@@ -1470,6 +1470,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;
}