diff --git a/kernel/audit.c b/kernel/audit.c index 8a82d481393d11b925cd791673995d50aaf64be8..7aef7cbd7bcf83dd9062ab3e008632ca13c7debe 100644 --- a/kernel/audit.c +++ b/kernel/audit.c @@ -1301,19 +1301,9 @@ static struct audit_buffer * audit_buffer_alloc(struct audit_context *ctx, */ unsigned int audit_serial(void) { - static DEFINE_SPINLOCK(serial_lock); - static unsigned int serial = 0; + static atomic_t serial = ATOMIC_INIT(0); - unsigned long flags; - unsigned int ret; - - spin_lock_irqsave(&serial_lock, flags); - do { - ret = ++serial; - } while (unlikely(!ret)); - spin_unlock_irqrestore(&serial_lock, flags); - - return ret; + return atomic_add_return(1, &serial); } static inline void audit_get_stamp(struct audit_context *ctx,