audit: send multicast messages only if there are listeners
authorRichard Guy Briggs <rgb@redhat.com>
Wed, 23 Apr 2014 01:31:58 +0000 (21:31 -0400)
committerDavid S. Miller <davem@davemloft.net>
Wed, 23 Apr 2014 01:42:27 +0000 (21:42 -0400)
Test first to see if there are any userspace multicast listeners bound to the
socket before starting the multicast send work.

Signed-off-by: Richard Guy Briggs <rgb@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
kernel/audit.c

index d272cc11dff4488e72f4660859696857d8eed2c5..33531d72e4a21014a68a98821bbef232edb9a2fb 100644 (file)
@@ -435,6 +435,9 @@ static void kauditd_send_multicast_skb(struct sk_buff *skb)
        struct audit_net        *aunet = net_generic(&init_net, audit_net_id);
        struct sock             *sock = aunet->nlsk;
 
+       if (!netlink_has_listeners(sock, AUDIT_NLGRP_READLOG))
+               return;
+
        /*
         * The seemingly wasteful skb_copy() rather than bumping the refcount
         * using skb_get() is necessary because non-standard mods are made to