[NETLINK]: Unhash sockets correctly.
Linux Kernel Mailing List <[email protected]> Wed, 16 Feb 2005 19:22:03 +0000
| Newsgroups | gmane.linux.kernel.commits.2-4 |
|---|---|
| Message-ID | <[email protected]> |
ChangeSet 1.1576, 2005/02/16 11:22:03-08:00, [email protected] [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 <[email protected]> Signed-off-by: David S. Miller <[email protected]> af_netlink.c | 3 ++- 1 files changed, 2 insertions(+), 1 deletion(-) diff -Nru a/net/netlink/af_netlink.c b/net/netlink/af_netlink.c --- a/net/netlink/af_netlink.c 2005-02-16 13:03:28 -08:00 +++ b/net/netlink/af_netlink.c 2005-02-16 13:03:28 -08: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);