scst_lib: Fix a use-after-free in an error path

Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com>
This commit is contained in:
Bart Van Assche
2015-05-03 08:16:18 +02:00
parent 63961f14aa
commit 8cf0fcbe86

View File

@@ -4165,7 +4165,7 @@ int scst_acg_add_lun(struct scst_acg *acg, struct kobject *parent,
{
int res;
struct scst_acg_dev *acg_dev;
struct scst_tgt_dev *tgt_dev;
struct scst_tgt_dev *tgt_dev, *tt;
struct scst_session *sess;
LIST_HEAD(tmp_tgt_dev_list);
@@ -4227,7 +4227,7 @@ out:
return res;
out_free:
list_for_each_entry(tgt_dev, &tmp_tgt_dev_list,
list_for_each_entry_safe(tgt_dev, tt, &tmp_tgt_dev_list,
extra_tgt_dev_list_entry) {
scst_free_tgt_dev(tgt_dev);
}