From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Miller Subject: Re: [PATCH net v2] net: bridge: Fix locking in br_fdb_find_port() Date: Fri, 08 Jun 2018 20:00:09 -0400 (EDT) Message-ID: <20180608.200009.1607578368137840763.davem@davemloft.net> References: Mime-Version: 1.0 Content-Type: Text/Plain; charset=us-ascii Content-Transfer-Encoding: 7bit Cc: bridge@lists.linux-foundation.org, netdev@vger.kernel.org, stephen@networkplumber.org To: petrm@mellanox.com Return-path: Received: from shards.monkeyblade.net ([184.105.139.130]:50004 "EHLO shards.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752691AbeFIAAL (ORCPT ); Fri, 8 Jun 2018 20:00:11 -0400 In-Reply-To: Sender: netdev-owner@vger.kernel.org List-ID: From: Petr Machata Date: Fri, 08 Jun 2018 15:11:47 +0200 > Callers of br_fdb_find() need to hold the hash lock, which > br_fdb_find_port() doesn't do. However, since br_fdb_find_port() is not > doing any actual FDB manipulation, the hash lock is not really needed at > all. So convert to br_fdb_find_rcu(), surrounded by rcu_read_lock() / > _unlock() pair. > > The device pointer copied from inside the FDB entry is then kept alive > by the RTNL lock, which br_fdb_find_port() asserts. > > Fixes: 4d4fd36126d6 ("net: bridge: Publish bridge accessor functions") > Signed-off-by: Petr Machata Applied, thank you.