From: Mathieu Desnoyers Date: Thu, 20 Feb 2020 14:58:42 +0000 (-0500) Subject: Fix: statedump: check task_active_pid_ns return value for NULL X-Git-Tag: before-upstreaming~33 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=adcc8b5e0be84d0b8c4b414d7db5b8c54e0b0466;p=lttng-modules.git Fix: statedump: check task_active_pid_ns return value for NULL The lttng-statedump checks the return value of task_active_pid_ns() before each use within lttng_statedump_process_pid_ns(), 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 Signed-off-by: Mathieu Desnoyers --- diff --git a/lttng-statedump-impl.c b/lttng-statedump-impl.c index 066b9612..043bbaa1 100644 --- a/lttng-statedump-impl.c +++ b/lttng-statedump-impl.c @@ -426,7 +426,7 @@ void lttng_statedump_process_ns(struct lttng_session *session, pid_ns = task_active_pid_ns(p); do { trace_lttng_statedump_process_pid_ns(session, p, pid_ns); - pid_ns = pid_ns->parent; + pid_ns = pid_ns ? pid_ns->parent : NULL; } while (pid_ns);