Fix: statedump: check task_active_pid_ns return value for NULL
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 20 Feb 2020 14:58:42 +0000 (09:58 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 20 Feb 2020 15:48:29 +0000 (10:48 -0500)
The lttng-statedump checks the return value of task_active_pid_ns()
before each use within trace_lttng_statedump_process_state(), but misses
the NULL check before dereferencing pid_ns->parent.

This race happens if a task exists in "dead" state while the statedump
iterates on that task.

Reported-by: Li Zhou <li.zhou@windriver.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lttng-statedump-impl.c

index 1c09e51a8ce6a454b4bb8c86b3e079789cc9cfcd..fb609e34edecf3c51f2572cc101ace8c27eef87a 100644 (file)
@@ -397,7 +397,7 @@ void lttng_statedump_process_ns(struct lttng_session *session,
        do {
                trace_lttng_statedump_process_state(session,
                        p, type, mode, submode, status, pid_ns);
-               pid_ns = pid_ns->parent;
+               pid_ns = pid_ns ? pid_ns->parent : NULL;
        } while (pid_ns);
 }
 
This page took 0.027726 seconds and 4 git commands to generate.