net/hsr: Move slave init to hsr_slave.c.

Also try to prevent some possible slave dereference race conditions. This is
finalized in the next patch, which abandons the slave array in favour of
a list_head list and list RCU.

Signed-off-by: Arvid Brodin <arvid.brodin@alten.se>
Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
Arvid Brodin
2014-07-04 23:37:27 +02:00
committed by David S. Miller
parent e9aae56ea4
commit 51f3c60531
6 changed files with 203 additions and 162 deletions

View File

@@ -455,6 +455,7 @@ int hsr_get_node_data(struct hsr_priv *hsr,
u16 *if2_seq)
{
struct hsr_node *node;
struct net_device *slave;
unsigned long tdiff;
@@ -491,8 +492,9 @@ int hsr_get_node_data(struct hsr_priv *hsr,
*if1_seq = node->seq_out[HSR_DEV_SLAVE_B];
*if2_seq = node->seq_out[HSR_DEV_SLAVE_A];
if ((node->AddrB_if != HSR_DEV_NONE) && hsr->slave[node->AddrB_if])
*addr_b_ifindex = hsr->slave[node->AddrB_if]->ifindex;
slave = hsr->slave[node->AddrB_if];
if ((node->AddrB_if != HSR_DEV_NONE) && slave)
*addr_b_ifindex = slave->ifindex;
else
*addr_b_ifindex = -1;