From: Mathieu Desnoyers Date: Tue, 11 Sep 2012 16:09:53 +0000 (-0400) Subject: Fix: statedump missing check for NULL namespace X-Git-Tag: v2.1.0~17 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=debfbc4ed959e6223cea1926d31255edbe51de9b;p=lttng-modules.git Fix: statedump missing check for NULL namespace Cause kernel OOPS. statedump PID namespace support is newly introduced in lttng-modules 2.1. Happens when iterating on a zombie process. Reported-by: David Goulet Signed-off-by: Mathieu Desnoyers --- diff --git a/instrumentation/events/lttng-module/lttng-statedump.h b/instrumentation/events/lttng-module/lttng-statedump.h index ea0b6d9d..d350cad3 100644 --- a/instrumentation/events/lttng-module/lttng-statedump.h +++ b/instrumentation/events/lttng-module/lttng-statedump.h @@ -67,10 +67,12 @@ TRACE_EVENT(lttng_statedump_process_state, struct task_struct *parent; pid_t ret = 0; - rcu_read_lock(); - parent = rcu_dereference(p->real_parent); - ret = task_tgid_nr_ns(parent, pid_ns); - rcu_read_unlock(); + if (pid_ns) { + rcu_read_lock(); + parent = rcu_dereference(p->real_parent); + ret = task_tgid_nr_ns(parent, pid_ns); + rcu_read_unlock(); + } ret; })) tp_memcpy(name, p->comm, TASK_COMM_LEN)