[PATCH 1/2] ids: Make sure kIDs is present in image
Cyrill Gorcunov
gorcunov at openvz.org
Thu Mar 14 16:43:30 EDT 2013
Otherwise yield error instead of nil dereference
if we meet a broken image.
Signed-off-by: Cyrill Gorcunov <gorcunov at openvz.org>
---
pstree.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/pstree.c b/pstree.c
index 5bfcbdc..64e8add 100644
--- a/pstree.c
+++ b/pstree.c
@@ -497,6 +497,14 @@ static int prepare_pstree_kobj_ids(void)
else
ids = root_ids;
+ /*
+ * Add some sanity check on image data.
+ */
+ if (unlikely(!ids)) {
+ pr_err("No kIDs provided, image corruption\n");
+ return -1;
+ }
+
cflags = get_clone_mask(item->ids, ids);
if (cflags & CLONE_FILES) {
--
1.8.1.4
--PEIAKu/WMn1b1Hv9--
More information about the CRIU
mailing list