summaryrefslogtreecommitdiffstats
path: root/net/netlink
diff options
context:
space:
mode:
authorEric Dumazet <edumazet@google.com>2012-04-22 21:30:29 +0000
committerDavid S. Miller <davem@davemloft.net>2012-04-24 00:35:14 -0400
commitbfb253c9b277acd9f85b1886ff82b1dd5fbff2ae (patch)
tree6239aa3416d30085e6043c42a5fff8d8fa6ecdc0 /net/netlink
parent658cb354edf0f16cc5a2a2bda3ec5be1bba25e6d (diff)
downloadlinux-bfb253c9b277acd9f85b1886ff82b1dd5fbff2ae.tar.gz
linux-bfb253c9b277acd9f85b1886ff82b1dd5fbff2ae.tar.bz2
linux-bfb253c9b277acd9f85b1886ff82b1dd5fbff2ae.zip
af_netlink: drop_monitor/dropwatch friendly
Need to consume_skb() instead of kfree_skb() in netlink_dump() and netlink_unicast_kernel() to avoid false dropwatch positives. Signed-off-by: Eric Dumazet <edumazet@google.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlink')
-rw-r--r--net/netlink/af_netlink.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 85d27f9f0e67..b3025a603d56 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -154,6 +154,12 @@ static void netlink_destroy_callback(struct netlink_callback *cb)
kfree(cb);
}
+static void netlink_consume_callback(struct netlink_callback *cb)
+{
+ consume_skb(cb->skb);
+ kfree(cb);
+}
+
static void netlink_sock_destruct(struct sock *sk)
{
struct netlink_sock *nlk = nlk_sk(sk);
@@ -902,8 +908,10 @@ static int netlink_unicast_kernel(struct sock *sk, struct sk_buff *skb)
ret = skb->len;
skb_set_owner_r(skb, sk);
nlk->netlink_rcv(skb);
+ consume_skb(skb);
+ } else {
+ kfree_skb(skb);
}
- kfree_skb(skb);
sock_put(sk);
return ret;
}
@@ -1728,7 +1736,7 @@ static int netlink_dump(struct sock *sk)
nlk->cb = NULL;
mutex_unlock(nlk->cb_mutex);
- netlink_destroy_callback(cb);
+ netlink_consume_callback(cb);
return 0;
errout_skb: