summaryrefslogtreecommitdiffstats
path: root/net/bridge/br_private.h
diff options
context:
space:
mode:
authorNikolay Aleksandrov <nikolay@cumulusnetworks.com>2017-02-13 14:59:10 +0100
committerDavid S. Miller <davem@davemloft.net>2017-02-14 12:41:03 -0500
commit410b3d48f5111a28bb8d4c3d3dc5984c1baf7fc9 (patch)
treebc656691dc1484ec5dbe7942535b3a63f75d265e /net/bridge/br_private.h
parentbfd0aeac52f74bfb44c0974131e44abb33a13e78 (diff)
downloadlinux-410b3d48f5111a28bb8d4c3d3dc5984c1baf7fc9.tar.gz
linux-410b3d48f5111a28bb8d4c3d3dc5984c1baf7fc9.tar.xz
bridge: fdb: add proper lock checks in searching functions
In order to avoid new errors add checks to br_fdb_find and fdb_find_rcu functions. The first requires hash_lock, the second obviously RCU. Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_private.h')
-rw-r--r--net/bridge/br_private.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 61368186edea..2288fca7756c 100644
--- a/net/bridge/br_private.h
+++ b/net/bridge/br_private.h
@@ -531,6 +531,15 @@ int br_fdb_external_learn_add(struct net_bridge *br, struct net_bridge_port *p,
int br_fdb_external_learn_del(struct net_bridge *br, struct net_bridge_port *p,
const unsigned char *addr, u16 vid);
+static inline bool br_hash_lock_held(struct net_bridge *br)
+{
+#ifdef CONFIG_LOCKDEP
+ return lockdep_is_held(&br->hash_lock);
+#else
+ return true;
+#endif
+}
+
/* br_forward.c */
enum br_pkt_type {
BR_PKT_UNICAST,