From: Mathieu Desnoyers Date: Thu, 20 Feb 2020 15:46:25 +0000 (-0500) Subject: Fix: statedump: consistently check task_cred_xxx() return value for NULL X-Git-Tag: before-upstreaming~32 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=1964cccb936a6dec5de336946f904b4b1006560e;p=lttng-modules.git Fix: statedump: consistently check task_cred_xxx() return value for NULL 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 --- diff --git a/lttng-statedump-impl.c b/lttng-statedump-impl.c index 043bbaa1..2ead9b6f 100644 --- a/lttng-statedump-impl.c +++ b/lttng-statedump-impl.c @@ -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); /*