From: Patrick McHardy <kaber@trash.net>
To: "David S. Miller" <davem@davemloft.net>
Cc: Maillist netdev <netdev@oss.sgi.com>
Subject: [PATCH 2.4 NETLINK]: Unhash sockets correctly
Date: Wed, 16 Feb 2005 19:54:17 +0100 [thread overview]
Message-ID: <421396D9.2030405@trash.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 286 bytes --]
Hi Dave,
this patch fixes a nasty bug introduced by the pid-hash backport.
Sockets are only unhashed if they are contained in the first hash
bucket. This leads to leaking sockets and, over time, to bind
conflicts which confuse iproute and result in sporadic failure.
Regards
Patrick
[-- Attachment #2: x --]
[-- Type: text/plain, Size: 1347 bytes --]
# This is a BitKeeper generated diff -Nru style patch.
#
# ChangeSet
# 2005/02/16 19:32:38+01:00 kaber@coreworks.de
# [NETLINK]: Unhash sockets correctly
#
# netlink_remove() only unhashes sockets contained in the
# first hash bucket. This leads to leaking sockets and,
# over time, to bind conflicts which confuse iproute.
#
# Signed-off-by: Patrick McHardy <kaber@trash.net>
#
# net/netlink/af_netlink.c
# 2005/02/16 19:32:36+01:00 kaber@coreworks.de +2 -1
# [NETLINK]: Unhash sockets correctly
#
# netlink_remove() only unhashes sockets contained in the
# first hash bucket. This leads to leaking sockets and,
# over time, to bind conflicts which confuse iproute.
#
# Signed-off-by: Patrick McHardy <kaber@trash.net>
#
diff -Nru a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c
--- a/net/netlink/af_netlink.c 2005-02-16 19:32:51 +01:00
+++ b/net/netlink/af_netlink.c 2005-02-16 19:32:51 +01:00
@@ -327,10 +327,11 @@
struct sock **skp;
struct netlink_table *table = &nl_table[sk->protocol];
struct nl_pid_hash *hash = &table->hash;
+ u32 pid = nlk_sk(sk)->pid;
netlink_table_grab();
hash->entries--;
- for (skp = hash->table; *skp; skp = &((*skp)->next)) {
+ for (skp = nl_pid_hashfn(hash, pid); *skp; skp = &((*skp)->next)) {
if (*skp == sk) {
*skp = sk->next;
__sock_put(sk);
next reply other threads:[~2005-02-16 18:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-02-16 18:54 Patrick McHardy [this message]
2005-02-16 19:52 ` [PATCH 2.4 NETLINK]: Unhash sockets correctly 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=421396D9.2030405@trash.net \
--to=kaber@trash.net \
--cc=davem@davemloft.net \
--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).