Commit 9e0e1864 authored by Dan Carpenter's avatar Dan Carpenter Committed by Ben Hutchings

target/iscsi: Fix double free in lio_target_tiqn_addtpg()

commit a91918cd upstream.

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>
Signed-off-by: default avatarBen Hutchings <ben@decadent.org.uk>
parent b6dea302
......@@ -253,7 +253,6 @@ int iscsit_tpg_add_portal_group(struct iscsi_tiqn *tiqn, struct iscsi_portal_gro
iscsi_release_param_list(tpg->param_list);
tpg->param_list = NULL;
}
kfree(tpg);
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