public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] audit: fixes in audit_log_drain()
@ 2005-01-15 23:08 Tommy Christensen
  2005-01-16  8:55 ` Tommy Christensen
  0 siblings, 1 reply; 2+ messages in thread
From: Tommy Christensen @ 2005-01-15 23:08 UTC (permalink / raw)
  To: jmorris; +Cc: linux-kernel

[-- Attachment #1: Type: text/plain, Size: 166 bytes --]

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

[-- Attachment #2: audit.c.patch --]
[-- Type: text/plain, Size: 834 bytes --]

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2005-01-16  8:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-01-15 23:08 [PATCH] audit: fixes in audit_log_drain() Tommy Christensen
2005-01-16  8:55 ` Tommy Christensen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox