aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Wahren <stefan.wahren@i2se.com>2015-05-09 07:58:09 +0000
committerDavid S. Miller <davem@davemloft.net>2015-05-11 11:01:20 -0400
commit268be0f7a7d9b3644bcb99568efba13cb208b627 (patch)
tree831fbcf9535f2394b7f66c8ffb2a7a7a672bf9d1
parentnet: mdio-gpio: Allow for unspecified bus id (diff)
downloadlinux-dev-268be0f7a7d9b3644bcb99568efba13cb208b627.tar.xz
linux-dev-268be0f7a7d9b3644bcb99568efba13cb208b627.zip
net: qca_spi: Fix possible race during probe
Registering the netdev before setting the priv data is unsafe. So fix this possible race by setting the priv data first. Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> Cc: <stable@vger.kernel.org> # v3.18+ Fixes: 291ab06e (net: qualcomm: new Ethernet over SPI driver for QCA7000) Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/qualcomm/qca_spi.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
index f66641d961e3..6af028d5f9bc 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.c
+++ b/drivers/net/ethernet/qualcomm/qca_spi.c
@@ -912,6 +912,8 @@ qca_spi_probe(struct spi_device *spi_device)
qca->spi_dev = spi_device;
qca->legacy_mode = legacy_mode;
+ spi_set_drvdata(spi_device, qcaspi_devs);
+
mac = of_get_mac_address(spi_device->dev.of_node);
if (mac)
@@ -944,8 +946,6 @@ qca_spi_probe(struct spi_device *spi_device)
return -EFAULT;
}
- spi_set_drvdata(spi_device, qcaspi_devs);
-
qcaspi_init_device_debugfs(qca);
return 0;