Commit e14086b2 authored by tangwenji's avatar tangwenji Committed by Greg Kroah-Hartman

iscsi-target: fix memory leak in lio_target_tiqn_addtpg()


[ Upstream commit 12d5a43b ]

tpg must free when call core_tpg_register() return fail
Signed-off-by: default avatartangwenji <tang.wenji@zte.com.cn>
Signed-off-by: default avatarNicholas Bellinger <nab@linux-iscsi.org>
Signed-off-by: default avatarSasha Levin <alexander.levin@verizon.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 7d93603d
...@@ -1210,7 +1210,7 @@ static struct se_portal_group *lio_target_tiqn_addtpg( ...@@ -1210,7 +1210,7 @@ static struct se_portal_group *lio_target_tiqn_addtpg(
ret = core_tpg_register(wwn, &tpg->tpg_se_tpg, SCSI_PROTOCOL_ISCSI); ret = core_tpg_register(wwn, &tpg->tpg_se_tpg, SCSI_PROTOCOL_ISCSI);
if (ret < 0) if (ret < 0)
return NULL; goto free_out;
ret = iscsit_tpg_add_portal_group(tiqn, tpg); ret = iscsit_tpg_add_portal_group(tiqn, tpg);
if (ret != 0) if (ret != 0)
...@@ -1222,6 +1222,7 @@ static struct se_portal_group *lio_target_tiqn_addtpg( ...@@ -1222,6 +1222,7 @@ static struct se_portal_group *lio_target_tiqn_addtpg(
return &tpg->tpg_se_tpg; return &tpg->tpg_se_tpg;
out: out:
core_tpg_deregister(&tpg->tpg_se_tpg); core_tpg_deregister(&tpg->tpg_se_tpg);
free_out:
kfree(tpg); kfree(tpg);
return NULL; return NULL;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment