[CRIU] [PATCH] shmem: handle errors of img_raw_fd()

Andrey Vagin avagin at openvz.org
Fri May 1 06:25:25 PDT 2015


Signed-off-by: Andrey Vagin <avagin at openvz.org>
---
 shmem.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/shmem.c b/shmem.c
index b2900f4..17a0153 100644
--- a/shmem.c
+++ b/shmem.c
@@ -156,6 +156,11 @@ static int restore_shmem_content(void *addr, struct shmem_info *si)
 		return -1;
 
 	fd_pg = img_raw_fd(pr.pi);
+	if (fd_pg < 0) {
+		ret = -1;
+		goto err;
+	}
+
 	while (1) {
 		unsigned long vaddr;
 		unsigned nr_pages;
@@ -190,6 +195,7 @@ static int restore_shmem_content(void *addr, struct shmem_info *si)
 			pr.put_pagemap(&pr);
 	}
 
+err:
 	pr.close(&pr);
 	return ret;
 }
-- 
2.1.0



More information about the CRIU mailing list