2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-31 06:15:24 +00:00

cgroups: fix use_after_free issue

list_for_each_entry_safe() should be used, you we are going to delete
something from a list.

CID 73383 (#1 of 1): Read from pointer after free (USE_AFTER_FREE)
4. deref_after_free: Dereferencing freed pointer prop.

Cc: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Andrey Vagin <avagin@openvz.org>
Acked-by: Tycho Andersen <tycho.andersen@canonical.com>
Signed-off-by: Pavel Emelyanov <xemul@parallels.com>
This commit is contained in:
Andrey Vagin
2014-10-31 17:50:45 +03:00
committed by Pavel Emelyanov
parent 609ce1f9af
commit 80f9494d25

View File

@@ -366,9 +366,10 @@ static void free_cgroup_prop(struct cgroup_prop *prop)
static void free_all_cgroup_props(struct cgroup_dir *ncd)
{
struct cgroup_prop *prop;
struct cgroup_prop *prop, *t;
list_for_each_entry(prop, &ncd->properties, list) {
list_for_each_entry_safe(prop, t, &ncd->properties, list) {
list_del(&prop->list);
free_cgroup_prop(prop);
}