lkml.org 
[lkml]   [2005]   [Jan]   [15]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] audit: fixes in audit_log_drain()
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@tpack.net>

-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) {
\
 
 \ /
  Last update: 2005-03-22 14:09    [from the cache]
©2003-2011 Jasper Spaans