From: Gao feng <gaofeng(a)cn.fujitsu.com>
If audit is disabled, we shouldn't generate loginuid audit
log.
Cc: stable(a)vger.kernel.org # v3.13-rc1
Acked-by: Eric Paris <eparis(a)redhat.com>
Signed-off-by: Gao feng <gaofeng(a)cn.fujitsu.com>
Signed-off-by: Richard Guy Briggs <rgb(a)redhat.com>
Signed-off-by: Eric Paris <eparis(a)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