[CRIU] [PATCH 3/3] cg: Add rollback in get_cg_set

Cyrill Gorcunov gorcunov at openvz.org
Thu Mar 31 07:39:45 PDT 2016


From: Cyrill Gorcunov <gorcunov at virtuozzo.com>

In case of error inside collect_cgroups we need

- @ctls list has been spliced into @cs->ctls so we cant just free it,
   but rather use put_ctls on @cs->ctls

- delete @cs->l from global @cg_sets list before free it

Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
---
 criu/cgroup.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/criu/cgroup.c b/criu/cgroup.c
index 44caf3c42fcb..e6b371ddc536 100644
--- a/criu/cgroup.c
+++ b/criu/cgroup.c
@@ -203,8 +203,11 @@ static struct cg_set *get_cg_set(struct list_head *ctls, unsigned int n_ctls, bo
 		}
 
 		if (collect && collect_cgroups(&cs->ctls)) {
-			put_ctls(ctls);
+			list_del(&cs->l);
+			n_sets--;
+			put_ctls(&cs->ctls);
 			xfree(cs);
+			INIT_LIST_HEAD(ctls);
 			return NULL;
 		}
 	}
-- 
2.5.5



More information about the CRIU mailing list