From: dingtianhong Date: Fri, 21 Feb 2014 08:08:53 +0000 (+0800) Subject: bonding: use rcu_dereference() to access curr_active_slave X-Git-Tag: firefly_0821_release~176^2~4167^2~285 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=4335d60e5e271497116fd77ed68dacca7cfb1548;p=firefly-linux-kernel-4.4.55.git bonding: use rcu_dereference() to access curr_active_slave 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 Cc: Veaceslav Falico Cc: Andy Gospodarek Signed-off-by: Ding Tianhong Signed-off-by: David S. Miller --- diff --git a/drivers/net/bonding/bond_procfs.c b/drivers/net/bonding/bond_procfs.c index 434df7360999..588cf39d832c 100644 --- a/drivers/net/bonding/bond_procfs.c +++ b/drivers/net/bonding/bond_procfs.c @@ -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));