diff options
-rw-r--r-- | kernel/audit.c | 4 | ||||
-rw-r--r-- | kernel/auditsc.c | 4 |
2 files changed, 6 insertions, 2 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index 27ffcf3..d321e25 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -625,7 +625,9 @@ unsigned int audit_serial(void) unsigned int ret; spin_lock_irqsave(&serial_lock, flags); - ret = serial++; + do { + ret = ++serial; + } while (unlikely(!ret)); spin_unlock_irqrestore(&serial_lock, flags); return ret; diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 242d45e..46b45ab 100644 --- a/kernel/auditsc.c +++ b/kernel/auditsc.c @@ -984,7 +984,7 @@ void audit_syscall_entry(struct task_struct *tsk, int arch, int major, if (likely(state == AUDIT_DISABLED)) return; - context->serial = audit_serial(); + context->serial = 0; context->ctime = CURRENT_TIME; context->in_syscall = 1; context->auditable = !!(state == AUDIT_RECORD_CONTEXT); @@ -1138,6 +1138,8 @@ void audit_inode(const char *name, const struct inode *inode, unsigned flags) void auditsc_get_stamp(struct audit_context *ctx, struct timespec *t, unsigned int *serial) { + if (!ctx->serial) + ctx->serial = audit_serial(); t->tv_sec = ctx->ctime.tv_sec; t->tv_nsec = ctx->ctime.tv_nsec; *serial = ctx->serial; |