netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: qca_spi: Fix possible race during probe
@ 2015-05-09  7:58 Stefan Wahren
  2015-05-11 15:01 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Stefan Wahren @ 2015-05-09  7:58 UTC (permalink / raw)
  To: David Miller; +Cc: netdev, Michael Heimpold, Stefan Wahren

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)
---
 drivers/net/ethernet/qualcomm/qca_spi.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/qualcomm/qca_spi.c b/drivers/net/ethernet/qualcomm/qca_spi.c
index 4a42e96..946317a 100644
--- a/drivers/net/ethernet/qualcomm/qca_spi.c
+++ b/drivers/net/ethernet/qualcomm/qca_spi.c
@@ -913,6 +913,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)
@@ -945,8 +947,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;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] net: qca_spi: Fix possible race during probe
  2015-05-09  7:58 [PATCH] net: qca_spi: Fix possible race during probe Stefan Wahren
@ 2015-05-11 15:01 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2015-05-11 15:01 UTC (permalink / raw)
  To: stefan.wahren; +Cc: netdev, michael.heimpold

From: Stefan Wahren <stefan.wahren@i2se.com>
Date: Sat,  9 May 2015 07:58:09 +0000

> 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)

Applied, thanks.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2015-05-11 15:01 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-05-09  7:58 [PATCH] net: qca_spi: Fix possible race during probe Stefan Wahren
2015-05-11 15:01 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).