Fix: statedump: consistently check task_cred_xxx() return value for NULL
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 20 Feb 2020 15:46:25 +0000 (10:46 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Thu, 20 Feb 2020 15:48:44 +0000 (10:48 -0500)
trace_lttng_statedump_process_user_ns() internally checks whether
user_ns is NULL. While this does not appear to be a possible return
value for task_cred_xxx(), err on the safe side and check for NULL here
as well to be consistent with the paranoid behavior of
trace_lttng_statedump_process_user_ns().

Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
lttng-statedump-impl.c

index 043bbaa1a8eaee4b91655f8649ed2e4fccfb8cc5..2ead9b6f12c1f99b7701d233a5c482d7a008e686 100644 (file)
@@ -433,7 +433,16 @@ void lttng_statedump_process_ns(struct lttng_session *session,
        user_ns = task_cred_xxx(p, user_ns);
        do {
                trace_lttng_statedump_process_user_ns(session, p, user_ns);
-               user_ns = user_ns->lttng_user_ns_parent;
+               /*
+                * trace_lttng_statedump_process_user_ns() internally
+                * checks whether user_ns is NULL. While this does not
+                * appear to be a possible return value for
+                * task_cred_xxx(), err on the safe side and check
+                * for NULL here as well to be consistent with the
+                * paranoid behavior of
+                * trace_lttng_statedump_process_user_ns().
+                */
+               user_ns = user_ns ? user_ns->lttng_user_ns_parent : NULL;
        } while (user_ns);
 
        /*
This page took 0.026906 seconds and 4 git commands to generate.