From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:35080 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754926AbbFMRCR (ORCPT ); Sat, 13 Jun 2015 13:02:17 -0400 Subject: Patch "netlink: Disable insertions/removals during rehash" has been added to the 4.0-stable tree To: herbert@gondor.apana.org.au, gregkh@linuxfoundation.org Cc: , From: Date: Sat, 13 Jun 2015 10:02:16 -0700 Message-ID: <1434214936180135@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ANSI_X3.4-1968 Content-Transfer-Encoding: 8bit Sender: stable-owner@vger.kernel.org List-ID: This is a note to let you know that I've just added the patch titled netlink: Disable insertions/removals during rehash to the 4.0-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: netlink-disable-insertions-removals-during-rehash.patch and it can be found in the queue-4.0 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. >>From foo@baz Sat Jun 13 09:48:35 PDT 2015 From: Herbert Xu Date: Sat, 16 May 2015 21:16:28 +0800 Subject: netlink: Disable insertions/removals during rehash From: Herbert Xu [ Upstream commit: Not applicable ] The current rhashtable rehash code is buggy and can't deal with parallel insertions/removals without corrupting the hash table. This patch disables it by partially reverting c5adde9468b0714a051eac7f9666f23eb10b61f7 ("netlink: eliminate nl_sk_hash_lock"). Signed-off-by: Herbert Xu Signed-off-by: Greg Kroah-Hartman --- net/netlink/af_netlink.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/net/netlink/af_netlink.c +++ b/net/netlink/af_netlink.c @@ -1052,7 +1052,7 @@ static int netlink_insert(struct sock *s struct netlink_table *table = &nl_table[sk->sk_protocol]; int err; - lock_sock(sk); + mutex_lock(&table->hash.mutex); err = -EBUSY; if (nlk_sk(sk)->portid) @@ -1074,7 +1074,7 @@ static int netlink_insert(struct sock *s } err: - release_sock(sk); + mutex_unlock(&table->hash.mutex); return err; } @@ -1083,10 +1083,12 @@ static void netlink_remove(struct sock * struct netlink_table *table; table = &nl_table[sk->sk_protocol]; + mutex_lock(&table->hash.mutex); if (rhashtable_remove(&table->hash, &nlk_sk(sk)->node)) { WARN_ON(atomic_read(&sk->sk_refcnt) == 1); __sock_put(sk); } + mutex_unlock(&table->hash.mutex); netlink_table_grab(); if (nlk_sk(sk)->subscriptions) { Patches currently in stable-queue which might be from herbert@gondor.apana.org.au are queue-4.0/netlink-disable-insertions-removals-during-rehash.patch queue-4.0/netlink-reset-portid-after-netlink_insert-failure.patch