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 27ffcf363f8d..d321e251d32b 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -625,7 +625,9 @@ unsigned int audit_serial(void) | |||
625 | unsigned int ret; | 625 | unsigned int ret; |
626 | 626 | ||
627 | spin_lock_irqsave(&serial_lock, flags); | 627 | spin_lock_irqsave(&serial_lock, flags); |
628 | ret = serial++; | 628 | do { |
629 | ret = ++serial; | ||
630 | } while (unlikely(!ret)); | ||
629 | spin_unlock_irqrestore(&serial_lock, flags); | 631 | spin_unlock_irqrestore(&serial_lock, flags); |
630 | 632 | ||
631 | return ret; | 633 | return ret; |
diff --git a/kernel/auditsc.c b/kernel/auditsc.c index 242d45e53738..46b45abceb9a 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, | |||
984 | if (likely(state == AUDIT_DISABLED)) | 984 | if (likely(state == AUDIT_DISABLED)) |
985 | return; | 985 | return; |
986 | 986 | ||
987 | context->serial = audit_serial(); | 987 | context->serial = 0; |
988 | context->ctime = CURRENT_TIME; | 988 | context->ctime = CURRENT_TIME; |
989 | context->in_syscall = 1; | 989 | context->in_syscall = 1; |
990 | context->auditable = !!(state == AUDIT_RECORD_CONTEXT); | 990 | context->auditable = !!(state == AUDIT_RECORD_CONTEXT); |
@@ -1138,6 +1138,8 @@ void audit_inode(const char *name, const struct inode *inode, unsigned flags) | |||
1138 | void auditsc_get_stamp(struct audit_context *ctx, | 1138 | void auditsc_get_stamp(struct audit_context *ctx, |
1139 | struct timespec *t, unsigned int *serial) | 1139 | struct timespec *t, unsigned int *serial) |
1140 | { | 1140 | { |
1141 | if (!ctx->serial) | ||
1142 | ctx->serial = audit_serial(); | ||
1141 | t->tv_sec = ctx->ctime.tv_sec; | 1143 | t->tv_sec = ctx->ctime.tv_sec; |
1142 | t->tv_nsec = ctx->ctime.tv_nsec; | 1144 | t->tv_nsec = ctx->ctime.tv_nsec; |
1143 | *serial = ctx->serial; | 1145 | *serial = ctx->serial; |