diff options
author | Eric Dumazet <eric.dumazet@gmail.com> | 2010-11-15 06:38:14 +0000 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-11-15 11:13:18 -0800 |
commit | ec1e5610c00c7f5bc530d2aadd47faa473b90a30 (patch) | |
tree | c3bc845f485911083e47e218e7f01eba4de1bbfd | |
parent | b5ed54e94d324f17c97852296d61a143f01b227a (diff) |
bridge: add RCU annotations to bridge port lookup
br_port_get() renamed to br_port_get_rtnl() to make clear RTNL is held.
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/bridge/br_if.c | 2 | ||||
-rw-r--r-- | net/bridge/br_netlink.c | 4 | ||||
-rw-r--r-- | net/bridge/br_notify.c | 4 | ||||
-rw-r--r-- | net/bridge/br_private.h | 5 |
4 files changed, 8 insertions, 7 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c index 427f90a8ab7..d9d1e2bac1d 100644 --- a/net/bridge/br_if.c +++ b/net/bridge/br_if.c @@ -475,7 +475,7 @@ int br_del_if(struct net_bridge *br, struct net_device *dev) { struct net_bridge_port *p; - p = br_port_get(dev); + p = br_port_get_rtnl(dev); if (!p || p->br != br) return -EINVAL; diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index e3de0a428f5..f8bf4c7f842 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c @@ -119,7 +119,7 @@ static int br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb) idx = 0; for_each_netdev(net, dev) { - struct net_bridge_port *port = br_port_get(dev); + struct net_bridge_port *port = br_port_get_rtnl(dev); /* not a bridge port */ if (!port || idx < cb->args[0]) @@ -171,7 +171,7 @@ static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg) if (!dev) return -ENODEV; - p = br_port_get(dev); + p = br_port_get_rtnl(dev); if (!p) return -EINVAL; diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c index ef2175c8b91..7d337c9b608 100644 --- a/net/bridge/br_notify.c +++ b/net/bridge/br_notify.c @@ -37,10 +37,10 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v int err; /* not a port of a bridge */ - if (!br_port_exists(dev)) + p = br_port_get_rtnl(dev); + if (!p) return NOTIFY_DONE; - p = br_port_get(dev); br = p->br; switch (event) { diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index 46e0bec1d7c..84aac7734bf 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h @@ -159,9 +159,10 @@ static inline struct net_bridge_port *br_port_get_rcu(const struct net_device *d return br_port_exists(dev) ? port : NULL; } -static inline struct net_bridge_port *br_port_get(struct net_device *dev) +static inline struct net_bridge_port *br_port_get_rtnl(struct net_device *dev) { - return br_port_exists(dev) ? dev->rx_handler_data : NULL; + return br_port_exists(dev) ? + rtnl_dereference(dev->rx_handler_data) : NULL; } struct br_cpu_netstats { |