staging: most: fix race condition in AIM networking
If the network device is being opened right after it has been registered via function register_netdev(), the device state is not yet consistent in the context of function ndo_open(). This patch cares about having the initialization done right, before the networking device is registered. Signed-off-by: Andrey Shvetsov <andrey.shvetsov@k2l.de> Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
bf358040c4
commit
25ef42f308
1 changed files with 3 additions and 0 deletions
|
@ -356,10 +356,13 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx,
|
||||||
}
|
}
|
||||||
|
|
||||||
nd->dev = dev;
|
nd->dev = dev;
|
||||||
|
ch->ch_id = channel_idx;
|
||||||
|
ch->linked = true;
|
||||||
|
|
||||||
dev->ml_priv = nd;
|
dev->ml_priv = nd;
|
||||||
if (register_netdev(dev)) {
|
if (register_netdev(dev)) {
|
||||||
pr_err("registering net device failed\n");
|
pr_err("registering net device failed\n");
|
||||||
|
ch->linked = false;
|
||||||
free_netdev(dev);
|
free_netdev(dev);
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue