mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-31 08:04:55 +00:00
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>
This commit is contained in:
parent
b5ed54e94d
commit
ec1e5610c0
@ -475,7 +475,7 @@ int br_del_if(struct net_bridge *br, struct net_device *dev)
|
|||||||
{
|
{
|
||||||
struct net_bridge_port *p;
|
struct net_bridge_port *p;
|
||||||
|
|
||||||
p = br_port_get(dev);
|
p = br_port_get_rtnl(dev);
|
||||||
if (!p || p->br != br)
|
if (!p || p->br != br)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ static int br_dump_ifinfo(struct sk_buff *skb, struct netlink_callback *cb)
|
|||||||
|
|
||||||
idx = 0;
|
idx = 0;
|
||||||
for_each_netdev(net, dev) {
|
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 */
|
/* not a bridge port */
|
||||||
if (!port || idx < cb->args[0])
|
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)
|
if (!dev)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
p = br_port_get(dev);
|
p = br_port_get_rtnl(dev);
|
||||||
if (!p)
|
if (!p)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
|
|
||||||
|
@ -37,10 +37,10 @@ static int br_device_event(struct notifier_block *unused, unsigned long event, v
|
|||||||
int err;
|
int err;
|
||||||
|
|
||||||
/* not a port of a bridge */
|
/* not a port of a bridge */
|
||||||
if (!br_port_exists(dev))
|
p = br_port_get_rtnl(dev);
|
||||||
|
if (!p)
|
||||||
return NOTIFY_DONE;
|
return NOTIFY_DONE;
|
||||||
|
|
||||||
p = br_port_get(dev);
|
|
||||||
br = p->br;
|
br = p->br;
|
||||||
|
|
||||||
switch (event) {
|
switch (event) {
|
||||||
|
@ -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;
|
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 {
|
struct br_cpu_netstats {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user