public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Tommy Christensen <tommy.christensen@tpack.net>
To: jmorris@redhat.com
Cc: linux-kernel@vger.kernel.org
Subject: [PATCH] audit: fixes in audit_log_drain()
Date: Sun, 16 Jan 2005 00:08:14 +0100	[thread overview]
Message-ID: <41E9A25E.3010902@tpack.net> (raw)

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

             reply	other threads:[~2005-01-15 23:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-15 23:08 Tommy Christensen [this message]
2005-01-16  8:55 ` [PATCH] audit: fixes in audit_log_drain() Tommy Christensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41E9A25E.3010902@tpack.net \
    --to=tommy.christensen@tpack.net \
    --cc=jmorris@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox