mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-03 07:45:17 +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:
committed by
Pavel Emelyanov
parent
609ce1f9af
commit
80f9494d25
5
cgroup.c
5
cgroup.c
@@ -366,9 +366,10 @@ static void free_cgroup_prop(struct cgroup_prop *prop)
|
|||||||
|
|
||||||
static void free_all_cgroup_props(struct cgroup_dir *ncd)
|
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);
|
free_cgroup_prop(prop);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user