2005-01-15 23:06:37

by Tommy Christensen

[permalink] [raw]
Subject: [PATCH] audit: fixes in audit_log_drain()

--- 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) {


Attachments:
audit.c.patch (834.00 B)

2005-01-16 08:53:18

by Tommy Christensen

[permalink] [raw]
Subject: Re: [PATCH] audit: fixes in audit_log_drain()

Tommy Christensen wrote:
> o Don't send shared skb's to netlink_unicast

Never mind. Herbert Xu made a better fix for this in netlink.

-Tommy