From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: netlink: Kill bogus lock_sock in netlink_insert Date: Fri, 15 May 2015 13:02:19 -0400 (EDT) Message-ID: <20150515.130219.331336809636676892.davem@redhat.com> References: <20150514042151.GA5482@gondor.apana.org.au> <20150514055824.GB6058@gondor.apana.org.au> <20150514060230.GD6058@gondor.apana.org.au> Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: eric.dumazet@gmail.com, tgraf@suug.ch, netdev@vger.kernel.org, ying.xue@windriver.com To: herbert@gondor.apana.org.au Return-path: Received: from mx1.redhat.com ([209.132.183.28]:46092 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753430AbbEORC1 (ORCPT ); Fri, 15 May 2015 13:02:27 -0400 In-Reply-To: <20150514060230.GD6058@gondor.apana.org.au> Sender: netdev-owner@vger.kernel.org List-ID: From: Herbert Xu Date: Thu, 14 May 2015 14:02:30 +0800 > The commit c5adde9468b0714a051eac7f9666f23eb10b61f7 ("netlink: > eliminate nl_sk_hash_lock") added a lock_sock to netlink_insert > with no justifications whatsoever. > > This patch kills it. > > Signed-off-by: Herbert Xu Actually, Herbert, I think this lock_sock() is needed. Otherwise nothing protects nlk_sk(sk)->portid, upon which we perform a non-atomic test-and-set operation here. If you remove the lock_sock(), two parallel bind/inserts are possible on the same socket, potentially resulting in socket state corruption.