Skip to content

Commit

Permalink
audit: fix endless wait in audit_log_start()
Browse files Browse the repository at this point in the history
After commit 8291991 ("kernel/audit.c: avoid negative sleep
durations") audit emitters will block forever if userspace daemon cannot
handle backlog.

After the timeout the waiting loop turns into busy loop and runs until
daemon dies or returns back to work.  This is a minimal patch for that
bug.

Signed-off-by: Konstantin Khlebnikov <[email protected]>
Cc: Luiz Capitulino <[email protected]>
Cc: Richard Guy Briggs <[email protected]>
Cc: Eric Paris <[email protected]>
Cc: Chuck Anderson <[email protected]>
Cc: Dan Duval <[email protected]>
Cc: Dave Kleikamp <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
koct9i authored and torvalds committed Sep 25, 2013
1 parent 0608f43 commit 8ac1c8d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions kernel/audit.c
Original file line number Diff line number Diff line change
Expand Up @@ -1117,9 +1117,10 @@ struct audit_buffer *audit_log_start(struct audit_context *ctx, gfp_t gfp_mask,

sleep_time = timeout_start + audit_backlog_wait_time -
jiffies;
if ((long)sleep_time > 0)
if ((long)sleep_time > 0) {
wait_for_auditd(sleep_time);
continue;
continue;
}
}
if (audit_rate_check() && printk_ratelimit())
printk(KERN_WARNING
Expand Down

0 comments on commit 8ac1c8d

Please sign in to comment.