diff options
author | Christian Gromm <christian.gromm@microchip.com> | 2015-09-28 17:18:32 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2015-09-29 03:18:49 +0200 |
commit | 25ef42f3084df7b7511f1a9f72678a95d444f579 (patch) | |
tree | c59bae737aaa8438aed6d6281858601200b25ede | |
parent | bf358040c448af3fc6446bcf0d998d2fd420a7fc (diff) | |
download | linux-25ef42f3084df7b7511f1a9f72678a95d444f579.tar.bz2 |
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>
-rw-r--r-- | drivers/staging/most/aim-network/networking.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/staging/most/aim-network/networking.c b/drivers/staging/most/aim-network/networking.c index dd368721b727..761c4cbff3e1 100644 --- a/drivers/staging/most/aim-network/networking.c +++ b/drivers/staging/most/aim-network/networking.c @@ -356,10 +356,13 @@ static int aim_probe_channel(struct most_interface *iface, int channel_idx, } nd->dev = dev; + ch->ch_id = channel_idx; + ch->linked = true; dev->ml_priv = nd; if (register_netdev(dev)) { pr_err("registering net device failed\n"); + ch->linked = false; free_netdev(dev); return -EINVAL; } |