[CRIU] [PATCH 1/3] seize: fix used after free case

Andrey Vagin avagin at openvz.org
Tue Sep 1 00:47:28 PDT 2015


*** CID 139496:  Memory - illegal accesses  (USE_AFTER_FREE)
---
 seize.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/seize.c b/seize.c
index 05df043..2e83de9 100644
--- a/seize.c
+++ b/seize.c
@@ -140,11 +140,10 @@ static int freeze_processes(void)
 			if (ret == 0)
 				continue;
 
-			if (seize_catch_task(pid)) {
+			if (seize_catch_task(pid) && state == frozen) {
 				/* fails when meets a zombie */
 				fclose(f);
-				if (state == frozen)
-					goto err;
+				goto err;
 			}
 		}
 		fclose(f);
-- 
2.4.3



More information about the CRIU mailing list