Commit a91918cd authored by Dan Carpenter's avatar Dan Carpenter Committed by Bart Van Assche

target/iscsi: Fix double free in lio_target_tiqn_addtpg()

This iscsit_tpg_add_portal_group() function is only called from
lio_target_tiqn_addtpg().  Both functions free the "tpg" pointer on
error so it's a double free bug.  The memory is allocated in the caller
so it should be freed in the caller and not here.

Fixes: e48354ce ("iscsi-target: Add iSCSI fabric support for target v4.1")
Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: default avatarDavid Disseldorp <ddiss@suse.de>
[ bvanassche: Added "Fix" at start of patch title ]
Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
parent d0905ca7
...@@ -260,7 +260,6 @@ int iscsit_tpg_add_portal_group(struct iscsi_tiqn *tiqn, struct iscsi_portal_gro ...@@ -260,7 +260,6 @@ int iscsit_tpg_add_portal_group(struct iscsi_tiqn *tiqn, struct iscsi_portal_gro
iscsi_release_param_list(tpg->param_list); iscsi_release_param_list(tpg->param_list);
tpg->param_list = NULL; tpg->param_list = NULL;
} }
kfree(tpg);
return -ENOMEM; return -ENOMEM;
} }
......
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