diff options
author | Richard Guy Briggs <rgb@redhat.com> | 2013-11-26 18:49:12 -0500 |
---|---|---|
committer | Eric Paris <eparis@redhat.com> | 2014-01-13 22:31:07 -0500 |
commit | 04ee1a3b8f0584099370f8501ac785fd5d2ed6ff (patch) | |
tree | 7efec1326aa33043d9c69b28ff45c1df9934e3a0 /kernel | |
parent | 61c0ee8792165f0de7c4aa619343998a6966c1ef (diff) |
audit: get rid of *NO* daemon at audit_pid=0 message
kauditd_send_skb is called after audit_pid was checked to be non-zero.
However, it can be set to 0 due to auditd exiting while kauditd_send_skb
is still executed and this can result in a spurious warning about missing
auditd.
Re-check audit_pid before printing the message.
Signed-off-by: Mateusz Guzik <mguzik@redhat.com>
Cc: Eric Paris <eparis@redhat.com>
Cc: linux-kernel@vger.kernel.org
Acked-by: Eric Paris <eparis@redhat.com>
Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: Eric Paris <eparis@redhat.com>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/audit.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/kernel/audit.c b/kernel/audit.c index 72bc1d0d1d0d..2dc757354693 100644 --- a/kernel/audit.c +++ b/kernel/audit.c | |||
@@ -410,10 +410,12 @@ static void kauditd_send_skb(struct sk_buff *skb) | |||
410 | err = netlink_unicast(audit_sock, skb, audit_nlk_portid, 0); | 410 | err = netlink_unicast(audit_sock, skb, audit_nlk_portid, 0); |
411 | if (err < 0) { | 411 | if (err < 0) { |
412 | BUG_ON(err != -ECONNREFUSED); /* Shouldn't happen */ | 412 | BUG_ON(err != -ECONNREFUSED); /* Shouldn't happen */ |
413 | printk(KERN_ERR "audit: *NO* daemon at audit_pid=%d\n", audit_pid); | 413 | if (audit_pid) { |
414 | audit_log_lost("auditd disappeared\n"); | 414 | printk(KERN_ERR "audit: *NO* daemon at audit_pid=%d\n", audit_pid); |
415 | audit_pid = 0; | 415 | audit_log_lost("auditd disappeared\n"); |
416 | audit_sock = NULL; | 416 | audit_pid = 0; |
417 | audit_sock = NULL; | ||
418 | } | ||
417 | /* we might get lucky and get this in the next auditd */ | 419 | /* we might get lucky and get this in the next auditd */ |
418 | audit_hold_skb(skb); | 420 | audit_hold_skb(skb); |
419 | } else | 421 | } else |