bonding: convert primary_slave to use RCU
This is necessary mainly for two bonding call sites: procfs and sysfs as it was dereferenced without any real protection. Signed-off-by: Nikolay Aleksandrov <nikolay@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
ecfede424e
commit
059b47e8aa
@@ -443,6 +443,7 @@ static int bond_fill_info(struct sk_buff *skb,
|
||||
unsigned int packets_per_slave;
|
||||
int ifindex, i, targets_added;
|
||||
struct nlattr *targets;
|
||||
struct slave *primary;
|
||||
|
||||
if (nla_put_u8(skb, IFLA_BOND_MODE, BOND_MODE(bond)))
|
||||
goto nla_put_failure;
|
||||
@@ -492,9 +493,9 @@ static int bond_fill_info(struct sk_buff *skb,
|
||||
bond->params.arp_all_targets))
|
||||
goto nla_put_failure;
|
||||
|
||||
if (bond->primary_slave &&
|
||||
nla_put_u32(skb, IFLA_BOND_PRIMARY,
|
||||
bond->primary_slave->dev->ifindex))
|
||||
primary = rtnl_dereference(bond->primary_slave);
|
||||
if (primary &&
|
||||
nla_put_u32(skb, IFLA_BOND_PRIMARY, primary->dev->ifindex))
|
||||
goto nla_put_failure;
|
||||
|
||||
if (nla_put_u8(skb, IFLA_BOND_PRIMARY_RESELECT,
|
||||
|
Reference in New Issue
Block a user