Skip to content

Commit

Permalink
af_netlink: drop_monitor/dropwatch friendly
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Eric Dumazet authored and David S. Miller committed Apr 24, 2012
1 parent 658cb35 commit bfb253c
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions net/netlink/af_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit bfb253c

Please sign in to comment.