[PATCH] audit: fixes in audit_log_drain()
From: Tommy Christensen
Date: Sat Jan 15 2005 - 18:07:36 EST
Would this be for you, James?
o Fix skb leak
o Don't send shared skb's to netlink_unicast
Signed-off-by: Tommy S. Christensen <tommy.christensen@xxxxxxxxx>
-Tommy
--- linux-2.6.11-rc1-bk3/kernel/audit.c 2005-01-12 14:54:15.000000000 +0100
+++ linux-2.6.11-work/kernel/audit.c 2005-01-15 23:51:25.399453674 +0100
@@ -483,6 +483,7 @@
while ((skb = skb_dequeue(&ab->sklist))) {
int retval = 0;
+ struct sk_buff *nskb;
if (audit_pid) {
if (ab->nlh) {
@@ -492,13 +493,17 @@
ab->nlh->nlmsg_seq = 0;
ab->nlh->nlmsg_pid = ab->pid;
}
- skb_get(skb); /* because netlink_* frees */
- retval = netlink_unicast(audit_sock, skb, audit_pid,
- MSG_DONTWAIT);
+ retval = -ENOMEM;
+ nskb = skb_clone(skb);
+ if (nskb)
+ retval = netlink_unicast(audit_sock, nskb,
+ audit_pid,
+ MSG_DONTWAIT);
}
if (retval == -EAGAIN && ab->count < 5) {
++ab->count;
audit_log_end_irq(ab);
+ kfree_skb(skb);
return 1;
}
if (retval < 0) {