mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 18:51:56 -04:00
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 <[email protected]> Signed-off-by: Paul Moore <[email protected]>
This commit is contained in:
parent
8443075eac
commit
833fc48d18
1 changed files with 4 additions and 1 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Reference in a new issue