Commit 37509e749dc2072e667db806ef24b9e897f61b8a
1 parent
c94c257c88
Exists in
master
and in
7 other branches
[AUDIT] Requeue messages at head of queue, up to audit_backlog
If netlink_unicast() fails, requeue the skb back at the head of the queue it just came from, instead of the tail. And do so unless we've exceeded the audit_backlog limit; not according to some other arbitrary limit. From: Chris Wright <chrisw@osdl.org> Signed-off-by: David Woodhouse <dwmw2@infradead.org>
Showing 1 changed file with 3 additions and 5 deletions Side-by-side Diff
kernel/audit.c
... | ... | @@ -142,7 +142,6 @@ |
142 | 142 | int total; |
143 | 143 | int type; |
144 | 144 | int pid; |
145 | - int count; /* Times requeued */ | |
146 | 145 | }; |
147 | 146 | |
148 | 147 | void audit_set_type(struct audit_buffer *ab, int type) |
... | ... | @@ -526,9 +525,9 @@ |
526 | 525 | retval = netlink_unicast(audit_sock, skb, audit_pid, |
527 | 526 | MSG_DONTWAIT); |
528 | 527 | } |
529 | - if (retval == -EAGAIN && ab->count < 5) { | |
530 | - ++ab->count; | |
531 | - skb_queue_tail(&ab->sklist, skb); | |
528 | + if (retval == -EAGAIN && | |
529 | + (atomic_read(&audit_backlog)) < audit_backlog_limit) { | |
530 | + skb_queue_head(&ab->sklist, skb); | |
532 | 531 | audit_log_end_irq(ab); |
533 | 532 | return 1; |
534 | 533 | } |
... | ... | @@ -666,7 +665,6 @@ |
666 | 665 | ab->total = 0; |
667 | 666 | ab->type = AUDIT_KERNEL; |
668 | 667 | ab->pid = 0; |
669 | - ab->count = 0; | |
670 | 668 | |
671 | 669 | #ifdef CONFIG_AUDITSYSCALL |
672 | 670 | if (ab->ctx) |