From: Luiz Capitulino <lcapitulino@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: viro@zeniv.linux.org.uk, eparis@redhat.com, dan.duval@oracle.com,
akpm@linux-foundation.org, rgb@redhat.com, oleg@redhat.com,
chuck.anderson@oracle.com
Subject: [PATCH 1/2] audit: flush_hold_queue(): don't drop queued SKBs
Date: Tue, 3 Sep 2013 00:48:54 -0400 [thread overview]
Message-ID: <1378183735-19338-2-git-send-email-lcapitulino@redhat.com> (raw)
In-Reply-To: <1378183735-19338-1-git-send-email-lcapitulino@redhat.com>
From: Luiz capitulino <lcapitulino@redhat.com>
flush_hold_queue() first dequeues an SKB and then checks if
auditd exists. If auditd doesn't exist, the SKB is silently
dropped.
Avoid this by not dequeing an SKB when we detected that
auditd disappeared.
Signed-off-by: Luiz capitulino <lcapitulino@redhat.com>
---
kernel/audit.c | 19 +++++++++----------
1 file changed, 9 insertions(+), 10 deletions(-)
diff --git a/kernel/audit.c b/kernel/audit.c
index 91e53d0..475c1d1 100644
--- a/kernel/audit.c
+++ b/kernel/audit.c
@@ -380,7 +380,7 @@ static void audit_printk_skb(struct sk_buff *skb)
audit_hold_skb(skb);
}
-static void kauditd_send_skb(struct sk_buff *skb)
+static int kauditd_send_skb(struct sk_buff *skb)
{
int err;
/* take a reference in case we can't send it and we want to hold it */
@@ -393,9 +393,12 @@ static void kauditd_send_skb(struct sk_buff *skb)
audit_pid = 0;
/* we might get lucky and get this in the next auditd */
audit_hold_skb(skb);
+ return err;
} else
/* drop the extra reference if sent ok */
consume_skb(skb);
+
+ return 0;
}
/*
@@ -416,6 +419,7 @@ static void kauditd_send_skb(struct sk_buff *skb)
static void flush_hold_queue(void)
{
struct sk_buff *skb;
+ int err;
if (!audit_default || !audit_pid)
return;
@@ -424,17 +428,12 @@ static void flush_hold_queue(void)
if (likely(!skb))
return;
- while (skb && audit_pid) {
- kauditd_send_skb(skb);
+ while (skb) {
+ err = kauditd_send_skb(skb);
+ if (err)
+ break;
skb = skb_dequeue(&audit_skb_hold_queue);
}
-
- /*
- * if auditd just disappeared but we
- * dequeued an skb we need to drop ref
- */
- if (skb)
- consume_skb(skb);
}
static int kauditd_thread(void *dummy)
--
1.8.1.4
next prev parent reply other threads:[~2013-09-03 4:49 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-09-03 4:48 [PATCH 0/2] audit: fix soft lockup Luiz Capitulino
2013-09-03 4:48 ` Luiz Capitulino [this message]
2013-09-03 4:48 ` [PATCH 2/2] audit: kaudit_send_skb(): make non-blocking call to netlink_unicast() Luiz Capitulino
2013-09-05 12:44 ` [PATCH 0/2] audit: fix soft lockup Luiz Capitulino
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=1378183735-19338-2-git-send-email-lcapitulino@redhat.com \
--to=lcapitulino@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=chuck.anderson@oracle.com \
--cc=dan.duval@oracle.com \
--cc=eparis@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=rgb@redhat.com \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®