[CRIU] [PATCH] criu: pstree_switch_state -- Fix nil deref on error path

Cyrill Gorcunov gorcunov at gmail.com
Wed Mar 16 01:52:24 PDT 2016


We may enter with @root_item = NULL in case of error
handling, so simply bail out.

Signed-off-by: Cyrill Gorcunov <gorcunov at virtuozzo.com>
---
 criu/seize.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/criu/seize.c b/criu/seize.c
index d187b74..0606586 100644
--- a/criu/seize.c
+++ b/criu/seize.c
@@ -463,6 +463,9 @@ void pstree_switch_state(struct pstree_item *root_item, int st)
 {
 	struct pstree_item *item = root_item;
 
+	if (!root_item)
+		return;
+
 	if (st != TASK_DEAD)
 		freezer_restore_state();
 
-- 
2.5.0



More information about the CRIU mailing list