[CRIU] [PATCH 5/8] pagemap: init pagemap entries array as NULL
Dmitry Safonov
dsafonov at virtuozzo.com
Fri Jul 15 12:28:44 PDT 2016
There is call to close_page_read on open_pages_image_at failure,
also on failure of init_pagemaps. pmes[] is uninitialized here
and free_pagemaps() will try to walk them and call xfree().
Which surely would lead to crash.
pagemap.c:317:6: warning: Branch condition evaluates to a garbage value
if (pr->pmes)
^~~~~~~~
Signed-off-by: Dmitry Safonov <dsafonov at virtuozzo.com>
---
criu/pagemap.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/criu/pagemap.c b/criu/pagemap.c
index fded26816f49..4743a0c17b6e 100644
--- a/criu/pagemap.c
+++ b/criu/pagemap.c
@@ -449,6 +449,7 @@ int open_page_read_at(int dfd, int pid, struct page_read *pr, int pr_flags)
pr->pi_off = 0;
pr->bunch.iov_len = 0;
pr->bunch.iov_base = NULL;
+ pr->pmes = NULL;
pr->pmi = open_image_at(dfd, i_typ, O_RSTR, (long)pid);
if (!pr->pmi)
--
2.9.0
More information about the CRIU
mailing list