Skip to content

Commit

Permalink
bonding: use rcu_dereference() to access curr_active_slave
Browse files Browse the repository at this point in the history
The bond_info_show_master already in RCU read-side critical section,
and the we access curr_active_slave without the curr_slave_lock, we
could not sure whether the curr_active_slave will be changed during
the processing, so use RCU to protected the pointer.

Cc: Jay Vosburgh <fubar@us.ibm.com>
Cc: Veaceslav Falico <vfalico@redhat.com>
Cc: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: Ding Tianhong <dingtianhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
dingtianhong authored and David S. Miller committed Feb 24, 2014
1 parent 8274180 commit 4335d60
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions drivers/net/bonding/bond_procfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ static void bond_info_show_master(struct seq_file *seq)
struct slave *curr;
int i;

read_lock(&bond->curr_slave_lock);
curr = bond->curr_active_slave;
read_unlock(&bond->curr_slave_lock);
curr = rcu_dereference(bond->curr_active_slave);

seq_printf(seq, "Bonding Mode: %s",
bond_mode_name(bond->params.mode));
Expand Down

0 comments on commit 4335d60

Please sign in to comment.