From 3e2bb820a3c3d74f5738590a9e4ca6f5580b4251 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 20 Feb 2020 09:58:42 -0500 Subject: [PATCH] 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 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 Signed-off-by: Mathieu Desnoyers --- lttng-statedump-impl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lttng-statedump-impl.c b/lttng-statedump-impl.c index 1c09e51a..fb609e34 100644 --- a/lttng-statedump-impl.c +++ b/lttng-statedump-impl.c @@ -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); } -- 2.34.1