Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Chris Wright and committed by
37509e74 c94c257c

+3 -5
+3 -5
kernel/audit.c
··· 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) ··· 525 526 retval = netlink_unicast(audit_sock, skb, audit_pid, 526 527 MSG_DONTWAIT); 527 528 } 528 - if (retval == -EAGAIN && ab->count < 5) { 529 - ++ab->count; 530 - skb_queue_tail(&ab->sklist, skb); 529 + if (retval == -EAGAIN && 530 + (atomic_read(&audit_backlog)) < audit_backlog_limit) { 531 + skb_queue_head(&ab->sklist, skb); 531 532 audit_log_end_irq(ab); 532 533 return 1; 533 534 } ··· 665 666 ab->total = 0; 666 667 ab->type = AUDIT_KERNEL; 667 668 ab->pid = 0; 668 - ab->count = 0; 669 669 670 670 #ifdef CONFIG_AUDITSYSCALL 671 671 if (ab->ctx)