If audit is disabled, we shouldn't generate loginuid audit
log.

Acked-by: Eric Paris <epa...@redhat.com>
Signed-off-by: Gao feng <gaof...@cn.fujitsu.com>
---
 kernel/auditsc.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 065c7a1..ceb396f 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1990,6 +1990,9 @@ static void audit_log_set_loginuid(kuid_t koldloginuid, 
kuid_t kloginuid,
        struct audit_buffer *ab;
        uid_t uid, ologinuid, nloginuid;
 
+       if (!audit_enabled)
+               return;
+
        uid = from_kuid(&init_user_ns, task_uid(current));
        ologinuid = from_kuid(&init_user_ns, koldloginuid);
        nloginuid = from_kuid(&init_user_ns, kloginuid),
-- 
1.8.3.1

--
Linux-audit mailing list
Linux-audit@redhat.com
https://www.redhat.com/mailman/listinfo/linux-audit

Reply via email to