Commit 1cdfd72f authored by Jiri Pirko's avatar Jiri Pirko Committed by David S. Miller

vlan: remove usage of dev->master in __vlan_find_dev_deep()

Also, since all users call __vlan_find_dev_deep() with rcu_read_lock,
make no possibility to call this with rtnl mutex held only.
Signed-off-by: default avatarJiri Pirko <jiri@resnulli.us>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 0347af51
...@@ -60,21 +60,25 @@ bool vlan_do_receive(struct sk_buff **skbp) ...@@ -60,21 +60,25 @@ bool vlan_do_receive(struct sk_buff **skbp)
return true; return true;
} }
/* Must be invoked with rcu_read_lock or with RTNL. */ /* Must be invoked with rcu_read_lock. */
struct net_device *__vlan_find_dev_deep(struct net_device *real_dev, struct net_device *__vlan_find_dev_deep(struct net_device *dev,
u16 vlan_id) u16 vlan_id)
{ {
struct vlan_info *vlan_info = rcu_dereference_rtnl(real_dev->vlan_info); struct vlan_info *vlan_info = rcu_dereference(dev->vlan_info);
if (vlan_info) { if (vlan_info) {
return vlan_group_get_device(&vlan_info->grp, vlan_id); return vlan_group_get_device(&vlan_info->grp, vlan_id);
} else { } else {
/* /*
* Bonding slaves do not have grp assigned to themselves. * Lower devices of master uppers (bonding, team) do not have
* Grp is assigned to bonding master instead. * grp assigned to themselves. Grp is assigned to upper device
* instead.
*/ */
if (netif_is_bond_slave(real_dev)) struct net_device *upper_dev;
return __vlan_find_dev_deep(real_dev->master, vlan_id);
upper_dev = netdev_master_upper_dev_get_rcu(dev);
if (upper_dev)
return __vlan_find_dev_deep(upper_dev, vlan_id);
} }
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment