summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Guy Briggs <rgb@redhat.com>2016-11-10 01:41:14 -0500
committerPaul Moore <paul@paul-moore.com>2016-11-20 15:28:22 -0500
commit833fc48d18ce3595990b405ae82a160b33028994 (patch)
treec7d89cf07ef9f18e1e09d3dcb87a66765e63513f
parent8443075eacb51df8539916c4170d2fdfe7c81433 (diff)
audit: skip sessionid sentinel value when auto-incrementing
The value (unsigned int)-1 is used as a sentinel to indicate the sessionID is unset. Skip this value when the session_id value wraps. Signed-off-by: Richard Guy Briggs <rgb@redhat.com> Signed-off-by: Paul Moore <paul@paul-moore.com>
-rw-r--r--kernel/auditsc.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/kernel/auditsc.c b/kernel/auditsc.c
index 8c434318ec8d..d161b17ce8ce 100644
--- a/kernel/auditsc.c
+++ b/kernel/auditsc.c
@@ -2025,8 +2025,11 @@ int audit_set_loginuid(kuid_t loginuid)
goto out;
/* are we setting or clearing? */
- if (uid_valid(loginuid))
+ if (uid_valid(loginuid)) {
sessionid = (unsigned int)atomic_inc_return(&session_id);
+ if (unlikely(sessionid == (unsigned int)-1))
+ sessionid = (unsigned int)atomic_inc_return(&session_id);
+ }
task->sessionid = sessionid;
task->loginuid = loginuid;