aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTommy S. Christensen <tommy.christensen@tpack.net>2005-05-19 16:07:32 -0400
committerDavid S. Miller <davem@davemloft.net>2005-05-19 16:07:32 -0400
commitaa1c6a6f7f0518b42994d02756a41cbfdcac1916 (patch)
treef56cbf31594d904ecc711269c14c206cf08c0126
parent68acc024ea7391e03c2c695ba0b9fb31baa974bf (diff)
[NETLINK]: Defer socket destruction a bit
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>
-rw-r--r--net/netlink/af_netlink.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
index 4b91f4b84cb7..e41ce458c2a9 100644
--- a/net/netlink/af_netlink.c
+++ b/net/netlink/af_netlink.c
@@ -789,11 +789,12 @@ int netlink_broadcast(struct sock *ssk, struct sk_buff *skb, u32 pid,
789 sk_for_each_bound(sk, node, &nl_table[ssk->sk_protocol].mc_list) 789 sk_for_each_bound(sk, node, &nl_table[ssk->sk_protocol].mc_list)
790 do_one_broadcast(sk, &info); 790 do_one_broadcast(sk, &info);
791 791
792 kfree_skb(skb);
793
792 netlink_unlock_table(); 794 netlink_unlock_table();
793 795
794 if (info.skb2) 796 if (info.skb2)
795 kfree_skb(info.skb2); 797 kfree_skb(info.skb2);
796 kfree_skb(skb);
797 798
798 if (info.delivered) { 799 if (info.delivered) {
799 if (info.congested && (allocation & __GFP_WAIT)) 800 if (info.congested && (allocation & __GFP_WAIT))