]> bbs.cooldavid.org Git - net-next-2.6.git/commitdiff
drop_monitor: convert some kfree_skb call sites to consume_skb
authorNeil Horman <nhorman@tuxdriver.com>
Tue, 20 Jul 2010 06:45:56 +0000 (06:45 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 20 Jul 2010 20:28:05 +0000 (13:28 -0700)
Convert a few calls from kfree_skb to consume_skb

Noticed while I was working on dropwatch that I was detecting lots of internal
skb drops in several places.  While some are legitimate, several were not,
freeing skbs that were at the end of their life, rather than being discarded due
to an error.  This patch converts those calls sites from using kfree_skb to
consume_skb, which quiets the in-kernel drop_monitor code from detecting them as
drops.  Tested successfully by myself

Signed-off-by: Neil Horman <nhorman@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
kernel/audit.c
net/netlink/af_netlink.c
net/unix/af_unix.c

index c71bd26631a28ccf3ecb1d90319b7b35f5e6f227..8296aa516c5a728ff3db1f61fe337b1f21e4a40b 100644 (file)
@@ -407,7 +407,7 @@ static void kauditd_send_skb(struct sk_buff *skb)
                audit_hold_skb(skb);
        } else
                /* drop the extra reference if sent ok */
-               kfree_skb(skb);
+               consume_skb(skb);
 }
 
 static int kauditd_thread(void *dummy)
index 7aeaa83193db96ecb0fb64f5d06db97168a1f9e6..8648a9922aabace0231de8eec18b88e30239fd5f 100644 (file)
@@ -1076,14 +1076,15 @@ int netlink_broadcast_filtered(struct sock *ssk, struct sk_buff *skb, u32 pid,
        sk_for_each_bound(sk, node, &nl_table[ssk->sk_protocol].mc_list)
                do_one_broadcast(sk, &info);
 
-       kfree_skb(skb);
+       consume_skb(skb);
 
        netlink_unlock_table();
 
-       kfree_skb(info.skb2);
-
-       if (info.delivery_failure)
+       if (info.delivery_failure) {
+               kfree_skb(info.skb2);
                return -ENOBUFS;
+       } else
+               consume_skb(info.skb2);
 
        if (info.delivered) {
                if (info.congested && (allocation & __GFP_WAIT))
index 75ba48b0d12a01de5146eba2fc0a78bf74232d98..4414a18c63b49601357789fb5d6df78326819ba7 100644 (file)
@@ -1906,7 +1906,7 @@ static int unix_stream_recvmsg(struct kiocb *iocb, struct socket *sock,
                                break;
                        }
 
-                       kfree_skb(skb);
+                       consume_skb(skb);
 
                        if (siocb->scm->fp)
                                break;