diff options
author | Hong Zhiguo <zhiguohong@tencent.com> | 2013-09-14 10:42:27 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2013-09-15 22:03:33 -0400 |
commit | 1fb1754a8c70d69ab480763c423e0a74369c4a67 (patch) | |
tree | 84ccb1544806928d3bfa10beff69027b3153f178 /net | |
parent | 3274f687520fd472b80ac386aa0aa24c657ae330 (diff) |
bridge: use br_port_get_rtnl within rtnl lock
current br_port_get_rcu is problematic in bridging path
(NULL deref). Change these calls in netlink path first.
Signed-off-by: Hong Zhiguo <zhiguohong@tencent.com>
Acked-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r-- | net/bridge/br_netlink.c | 4 | ||||
-rw-r--r-- | net/bridge/br_private.h | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/net/bridge/br_netlink.c b/net/bridge/br_netlink.c index b9259efa636e..e74ddc1c29a8 100644 --- a/net/bridge/br_netlink.c +++ b/net/bridge/br_netlink.c | |||
@@ -207,7 +207,7 @@ int br_getlink(struct sk_buff *skb, u32 pid, u32 seq, | |||
207 | struct net_device *dev, u32 filter_mask) | 207 | struct net_device *dev, u32 filter_mask) |
208 | { | 208 | { |
209 | int err = 0; | 209 | int err = 0; |
210 | struct net_bridge_port *port = br_port_get_rcu(dev); | 210 | struct net_bridge_port *port = br_port_get_rtnl(dev); |
211 | 211 | ||
212 | /* not a bridge port and */ | 212 | /* not a bridge port and */ |
213 | if (!port && !(filter_mask & RTEXT_FILTER_BRVLAN)) | 213 | if (!port && !(filter_mask & RTEXT_FILTER_BRVLAN)) |
@@ -451,7 +451,7 @@ static size_t br_get_link_af_size(const struct net_device *dev) | |||
451 | struct net_port_vlans *pv; | 451 | struct net_port_vlans *pv; |
452 | 452 | ||
453 | if (br_port_exists(dev)) | 453 | if (br_port_exists(dev)) |
454 | pv = nbp_get_vlan_info(br_port_get_rcu(dev)); | 454 | pv = nbp_get_vlan_info(br_port_get_rtnl(dev)); |
455 | else if (dev->priv_flags & IFF_EBRIDGE) | 455 | else if (dev->priv_flags & IFF_EBRIDGE) |
456 | pv = br_get_vlan_info((struct net_bridge *)netdev_priv(dev)); | 456 | pv = br_get_vlan_info((struct net_bridge *)netdev_priv(dev)); |
457 | else | 457 | else |
diff --git a/net/bridge/br_private.h b/net/bridge/br_private.h index cda83158a21c..dd583177cba4 100644 --- a/net/bridge/br_private.h +++ b/net/bridge/br_private.h | |||
@@ -208,7 +208,7 @@ static inline struct net_bridge_port *br_port_get_rcu(const struct net_device *d | |||
208 | return br_port_exists(dev) ? port : NULL; | 208 | return br_port_exists(dev) ? port : NULL; |
209 | } | 209 | } |
210 | 210 | ||
211 | static inline struct net_bridge_port *br_port_get_rtnl(struct net_device *dev) | 211 | static inline struct net_bridge_port *br_port_get_rtnl(const struct net_device *dev) |
212 | { | 212 | { |
213 | return br_port_exists(dev) ? | 213 | return br_port_exists(dev) ? |
214 | rtnl_dereference(dev->rx_handler_data) : NULL; | 214 | rtnl_dereference(dev->rx_handler_data) : NULL; |