From ad60f0e7355900da8ae3c1ab96a557dbc747b233 Mon Sep 17 00:00:00 2001 From: Chetan C R Date: Tue, 15 May 2018 18:08:38 +0530 Subject: [PATCH] audit: Checks valid value of audit_signals and tsk->audit_context There can be a case when current task's audit context may be NULL or even if it is not NULL, it can have invalid non-zero value of dummy variable and also we should audit the signal only if we have non-zero value of audit_signals. Issue has been seen during power on/off tests. So better to add explicit check on these variables. Change-Id: I2f3e17d933fca8e3b8f4013f44f942f11c68f440 Signed-off-by: Chetan C R --- kernel/auditsc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 6375465af0a7..b72f4f5616ac 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -2248,10 +2248,11 @@ int __audit_signal_info(int sig, struct task_struct *t) audit_sig_uid = uid; security_task_getsecid(tsk, &audit_sig_sid); } - if (!audit_signals || audit_dummy_context()) - return 0; } + if (!audit_signals || audit_dummy_context()) + return 0; + /* optimize the common case by putting first signal recipient directly * in audit_context */ if (!ctx->target_pid) {