提交 4335d60e 编写于 作者: D dingtianhong 提交者: David S. Miller

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 <fubar@us.ibm.com>
Cc: Veaceslav Falico <vfalico@redhat.com>
Cc: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: NDing Tianhong <dingtianhong@huawei.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 82741808
...@@ -69,9 +69,7 @@ static void bond_info_show_master(struct seq_file *seq) ...@@ -69,9 +69,7 @@ static void bond_info_show_master(struct seq_file *seq)
struct slave *curr; struct slave *curr;
int i; int i;
read_lock(&bond->curr_slave_lock); curr = rcu_dereference(bond->curr_active_slave);
curr = bond->curr_active_slave;
read_unlock(&bond->curr_slave_lock);
seq_printf(seq, "Bonding Mode: %s", seq_printf(seq, "Bonding Mode: %s",
bond_mode_name(bond->params.mode)); bond_mode_name(bond->params.mode));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册