netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] netlink: defer socket destruction a bit
@ 2005-05-11 22:19 Tommy Christensen
  2005-05-11 22:24 ` Herbert Xu
  0 siblings, 1 reply; 10+ messages in thread
From: Tommy Christensen @ 2005-05-11 22:19 UTC (permalink / raw)
  To: David S. Miller, Herbert Xu; +Cc: netdev, Ken-ichirou MATSUZAWA

[-- Attachment #1: Type: text/plain, Size: 408 bytes --]

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>

[-- Attachment #2: netlink-2.patch --]
[-- Type: text/plain, Size: 568 bytes --]

diff -ru linux-2.6.12-rc4/net/netlink/af_netlink.c linux-2.6.12-work/net/netlink/af_netlink.c
--- linux-2.6.12-rc4/net/netlink/af_netlink.c	2005-05-11 11:10:20.000000000 +0200
+++ linux-2.6.12-work/net/netlink/af_netlink.c	2005-05-12 00:11:08.990990172 +0200
@@ -785,11 +785,12 @@
 	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))

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2005-05-19 23:16 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-05-11 22:19 [PATCH] netlink: defer socket destruction a bit Tommy Christensen
2005-05-11 22:24 ` Herbert Xu
2005-05-11 22:35   ` Tommy Christensen
2005-05-11 23:03     ` Herbert Xu
2005-05-12  9:57       ` Tommy Christensen
2005-05-12 10:36         ` Herbert Xu
2005-05-19 20:08           ` David S. Miller
2005-05-19 21:38             ` Herbert Xu
2005-05-19 23:15               ` Tommy Christensen
2005-05-19 23:16                 ` David S. Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).