Skip to content

Commit

Permalink
[NETLINK]: Defer socket destruction a bit
Browse files Browse the repository at this point in the history
In netlink_broadcast() we're sending shared skb's to netlink listeners
when possible (saves some copying). This is OK, since we hold the only
other reference to the skb.

However, this implies that we must drop our reference on the skb, before
allowing a receiving socket to disappear. Otherwise, the socket buffer
accounting is disrupted.

Signed-off-by: Tommy S. Christensen <tommy.christensen@tpack.net>
Acked-by: Herbert Xu <herbert@gondor.apana.org.au>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Tommy S. Christensen authored and David S. Miller committed May 19, 2005
1 parent 68acc02 commit aa1c6a6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion net/netlink/af_netlink.c
Original file line number Diff line number Diff line change
Expand Up @@ -789,11 +789,12 @@ int netlink_broadcast(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);

netlink_unlock_table();

if (info.skb2)
kfree_skb(info.skb2);
kfree_skb(skb);

if (info.delivered) {
if (info.congested && (allocation & __GFP_WAIT))
Expand Down

0 comments on commit aa1c6a6

Please sign in to comment.