[CRIU] [PATCH 1/2] ids: Make sure root ids is present in image

Cyrill Gorcunov gorcunov at openvz.org
Thu Mar 14 16:50:23 EDT 2013


Otherwise yield error instead of nil dereference.

Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
 pstree.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/pstree.c b/pstree.c
index 5bfcbdc..4f4d938 100644
--- a/pstree.c
+++ b/pstree.c
@@ -494,9 +494,19 @@ static int prepare_pstree_kobj_ids(void)
 
 		if (parent)
 			ids = parent->ids;
-		else
+		else {
 			ids = root_ids;
 
+			/*
+			 * Add some sanity check on image data.
+			 */
+			if (unlikely(!ids)) {
+				pr_err("No root-kIDs provided, "
+				       "image corruption\n");
+				return -1;
+			}
+		}
+
 		cflags = get_clone_mask(item->ids, ids);
 
 		if (cflags & CLONE_FILES) {
-- 
1.8.1.4



More information about the CRIU mailing list