From: Tommy Christensen <tommy.christensen@tpack.net>
To: "David S. Miller" <davem@davemloft.net>,
Herbert Xu <herbert@gondor.apana.org.au>
Cc: netdev@oss.sgi.com, Ken-ichirou MATSUZAWA <chamas@h4.dion.ne.jp>
Subject: [PATCH] netlink: defer socket destruction a bit
Date: Thu, 12 May 2005 00:19:02 +0200 [thread overview]
Message-ID: <428284D6.9000804@tpack.net> (raw)
[-- 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))
next reply other threads:[~2005-05-11 22:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-11 22:19 Tommy Christensen [this message]
2005-05-11 22:24 ` [PATCH] netlink: defer socket destruction a bit 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=428284D6.9000804@tpack.net \
--to=tommy.christensen@tpack.net \
--cc=chamas@h4.dion.ne.jp \
--cc=davem@davemloft.net \
--cc=herbert@gondor.apana.org.au \
--cc=netdev@oss.sgi.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).