From: Gao feng <gaof...@cn.fujitsu.com>

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

Cc: sta...@vger.kernel.org # v3.13-rc1
Acked-by: Eric Paris <epa...@redhat.com>
Signed-off-by: Gao feng <gaof...@cn.fujitsu.com>
Signed-off-by: Richard Guy Briggs <r...@redhat.com>
Signed-off-by: Eric Paris <epa...@redhat.com>
---

Already upstream in 3.14-rc1.  This fixes a bug introduced by:
        da0a6104 audit: loginuid functions coding style


 kernel/auditsc.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index df1e685..9ab02fa 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -1971,6 +1971,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.7.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Reply via email to