]> git.baikalelectronics.ru Git - kernel.git/commit
net: bridge: Fix locking in br_fdb_find_port()
authorPetr Machata <petrm@mellanox.com>
Fri, 8 Jun 2018 13:11:47 +0000 (15:11 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 8 Jun 2018 23:58:31 +0000 (19:58 -0400)
commit346eaf17ad740a7b9f731b4fd9a0673e08f3f93e
treeea70348861f364b709118946a5216a91cd421a00
parent9009359dc115d2b3f5f5f3d29e4b5d97d19d37f2
net: bridge: Fix locking in br_fdb_find_port()

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: 3a6127e211c2 ("net: bridge: Publish bridge accessor functions")
Signed-off-by: Petr Machata <petrm@mellanox.com>
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_fdb.c