diff options
author | Nikolay Aleksandrov <nikolay@redhat.com> | 2014-09-09 23:17:00 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2014-09-10 02:31:35 +0200 |
commit | 059b47e8aaf997245bc531e980581de492315fe6 (patch) | |
tree | e6f179bf980f970af3e53659b491828570f6616d /drivers/net/bonding/bond_procfs.c | |
parent | bonding: alb: clean bond->lock (diff) | |
download | linux-059b47e8aaf997245bc531e980581de492315fe6.tar.xz linux-059b47e8aaf997245bc531e980581de492315fe6.zip |
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>
Diffstat (limited to 'drivers/net/bonding/bond_procfs.c')
-rw-r--r-- | drivers/net/bonding/bond_procfs.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c index de62c0385dfb..1a9fe1ba4c60 100644 --- a/drivers/net/bonding/bond_procfs.c +++ b/drivers/net/bonding/bond_procfs.c @@ -66,7 +66,7 @@ static void bond_info_show_master(struct seq_file *seq) { struct bonding *bond = seq->private; const struct bond_opt_value *optval; - struct slave *curr; + struct slave *curr, *primary; int i; curr = rcu_dereference(bond->curr_active_slave); @@ -92,10 +92,10 @@ static void bond_info_show_master(struct seq_file *seq) } if (bond_uses_primary(bond)) { + primary = rcu_dereference(bond->primary_slave); seq_printf(seq, "Primary Slave: %s", - (bond->primary_slave) ? - bond->primary_slave->dev->name : "None"); - if (bond->primary_slave) { + primary ? primary->dev->name : "None"); + if (primary) { optval = bond_opt_get_val(BOND_OPT_PRIMARY_RESELECT, bond->params.primary_reselect); seq_printf(seq, " (primary_reselect %s)", |