aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge
diff options
context:
space:
mode:
authorEric Dumazet <eric.dumazet@gmail.com>2010-11-15 01:38:14 -0500
committerDavid S. Miller <davem@davemloft.net>2010-11-15 14:13:18 -0500
commitec1e5610c00c7f5bc530d2aadd47faa473b90a30 (patch)
treec3bc845f485911083e47e218e7f01eba4de1bbfd /net/bridge
parentb5ed54e94d324f17c97852296d61a143f01b227a (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>
Diffstat (limited to 'net/bridge')
-rw-r--r--net/bridge/br_if.c2
-rw-r--r--net/bridge/br_netlink.c4
-rw-r--r--net/bridge/br_notify.c4
-rw-r--r--net/bridge/br_private.h5
4 files changed, 8 insertions, 7 deletions
diff --git a/net/bridge/br_if.c b/net/bridge/br_if.c
index 427f90a8ab7b..d9d1e2bac1d6 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)
475{ 475{
476 struct net_bridge_port *p; 476 struct net_bridge_port *p;
477 477
478 p = br_port_get(dev); 478 p = br_port_get_rtnl(dev);
479 if (!p || p->br != br) 479 if (!p || p->br != br)
480 return -EINVAL; 480 return -EINVAL;
481 481
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c
index e3de0a428f5d..f8bf4c7f842c 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)
119 119
120 idx = 0; 120 idx = 0;
121 for_each_netdev(net, dev) { 121 for_each_netdev(net, dev) {
122 struct net_bridge_port *port = br_port_get(dev); 122 struct net_bridge_port *port = br_port_get_rtnl(dev);
123 123
124 /* not a bridge port */ 124 /* not a bridge port */
125 if (!port || idx < cb->args[0]) 125 if (!port || idx < cb->args[0])
@@ -171,7 +171,7 @@ static int br_rtm_setlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
171 if (!dev) 171 if (!dev)
172 return -ENODEV; 172 return -ENODEV;
173 173
174 p = br_port_get(dev); 174 p = br_port_get_rtnl(dev);
175 if (!p) 175 if (!p)
176 return -EINVAL; 176 return -EINVAL;
177 177
diff --git a/net/bridge/br_notify.c b/net/bridge/br_notify.c
index ef2175c8b91d..7d337c9b6082 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
37 int err; 37 int err;
38 38
39 /* not a port of a bridge */ 39 /* not a port of a bridge */
40 if (!br_port_exists(dev)) 40 p = br_port_get_rtnl(dev);
41 if (!p)
41 return NOTIFY_DONE; 42 return NOTIFY_DONE;
42 43
43 p = br_port_get(dev);
44 br = p->br; 44 br = p->br;
45 45
46 switch (event) { 46 switch (event) {
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h
index 46e0bec1d7c5..84aac7734bfc 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
159 return br_port_exists(dev) ? port : NULL; 159 return br_port_exists(dev) ? port : NULL;
160} 160}
161 161
162static inline struct net_bridge_port *br_port_get(struct net_device *dev) 162static inline struct net_bridge_port *br_port_get_rtnl(struct net_device *dev)
163{ 163{
164 return br_port_exists(dev) ? dev->rx_handler_data : NULL; 164 return br_port_exists(dev) ?
165 rtnl_dereference(dev->rx_handler_data) : NULL;
165} 166}
166 167
167struct br_cpu_netstats { 168struct br_cpu_netstats {