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

scst_free_tgt_dev() frees the memory tgt_dev points at which means
that list_for_each_entry_safe() is needed here.


git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@6356 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
Bart Van Assche
2015-06-17 00:00:40 +00:00
parent e31d1999f3
commit a6f9f870b3
+2 -2
View File
@@ -4167,7 +4167,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);
@@ -4229,7 +4229,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);
}