From: Richard Guy Briggs Date: Tue, 26 Nov 2013 23:49:12 +0000 (-0500) Subject: audit: get rid of *NO* daemon at audit_pid=0 message X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=04ee1a3b8f0584099370f8501ac785fd5d2ed6ff;p=GitHub%2Fexynos8895%2Fandroid_kernel_samsung_universal8895.git 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 Cc: Eric Paris Cc: linux-kernel@vger.kernel.org Acked-by: Eric Paris Signed-off-by: Richard Guy Briggs Signed-off-by: Eric Paris --- 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) err = netlink_unicast(audit_sock, skb, audit_nlk_portid, 0); if (err < 0) { BUG_ON(err != -ECONNREFUSED); /* Shouldn't happen */ - printk(KERN_ERR "audit: *NO* daemon at audit_pid=%d\n", audit_pid); - audit_log_lost("auditd disappeared\n"); - audit_pid = 0; - audit_sock = NULL; + if (audit_pid) { + printk(KERN_ERR "audit: *NO* daemon at audit_pid=%d\n", audit_pid); + audit_log_lost("auditd disappeared\n"); + audit_pid = 0; + audit_sock = NULL; + } /* we might get lucky and get this in the next auditd */ audit_hold_skb(skb); } else