Commit bfb253c9 authored by Eric Dumazet's avatar Eric Dumazet Committed by David S. Miller

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: default avatarEric Dumazet <edumazet@google.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 658cb354
...@@ -154,6 +154,12 @@ static void netlink_destroy_callback(struct netlink_callback *cb) ...@@ -154,6 +154,12 @@ static void netlink_destroy_callback(struct netlink_callback *cb)
kfree(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) static void netlink_sock_destruct(struct sock *sk)
{ {
struct netlink_sock *nlk = nlk_sk(sk); struct netlink_sock *nlk = nlk_sk(sk);
...@@ -902,8 +908,10 @@ static int netlink_unicast_kernel(struct sock *sk, struct sk_buff *skb) ...@@ -902,8 +908,10 @@ static int netlink_unicast_kernel(struct sock *sk, struct sk_buff *skb)
ret = skb->len; ret = skb->len;
skb_set_owner_r(skb, sk); skb_set_owner_r(skb, sk);
nlk->netlink_rcv(skb); nlk->netlink_rcv(skb);
consume_skb(skb);
} else {
kfree_skb(skb);
} }
kfree_skb(skb);
sock_put(sk); sock_put(sk);
return ret; return ret;
} }
...@@ -1728,7 +1736,7 @@ static int netlink_dump(struct sock *sk) ...@@ -1728,7 +1736,7 @@ static int netlink_dump(struct sock *sk)
nlk->cb = NULL; nlk->cb = NULL;
mutex_unlock(nlk->cb_mutex); mutex_unlock(nlk->cb_mutex);
netlink_destroy_callback(cb); netlink_consume_callback(cb);
return 0; return 0;
errout_skb: errout_skb:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment