netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Do not register ne2k-pci device until initialized
@ 2009-05-02 16:28 Lubomir Rintel
  2009-05-02 17:05 ` Jeff Garzik
  0 siblings, 1 reply; 6+ messages in thread
From: Lubomir Rintel @ 2009-05-02 16:28 UTC (permalink / raw)
  To: netdev, Andrew Morton, Linux Kernel Mailing List, stable

Doing it in reverse order causes uevent to be sent before
we have a MAC address, which confuses udev.

Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
---
 drivers/net/ne2k-pci.c |    7 +++----
 1 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ne2k-pci.c b/drivers/net/ne2k-pci.c
index eb66f65..7d83896 100644
--- a/drivers/net/ne2k-pci.c
+++ b/drivers/net/ne2k-pci.c
@@ -374,18 +374,17 @@ static int __devinit ne2k_pci_init_one (struct pci_dev *pdev,
 	dev->ethtool_ops = &ne2k_pci_ethtool_ops;
 	NS8390_init(dev, 0);
 
+	memcpy(dev->dev_addr, SA_prom, 6);
+	memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
+
 	i = register_netdev(dev);
 	if (i)
 		goto err_out_free_netdev;
 
-	for(i = 0; i < 6; i++)
-		dev->dev_addr[i] = SA_prom[i];
 	printk("%s: %s found at %#lx, IRQ %d, %pM.\n",
 	       dev->name, pci_clone_list[chip_idx].name, ioaddr, dev->irq,
 	       dev->dev_addr);
 
-	memcpy(dev->perm_addr, dev->dev_addr, dev->addr_len);
-
 	return 0;
 
 err_out_free_netdev:

-- 
"Excuse all the blood" -- Dead


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

* Re: [PATCH] Do not register ne2k-pci device until initialized
  2009-05-02 16:28 [PATCH] Do not register ne2k-pci device until initialized Lubomir Rintel
@ 2009-05-02 17:05 ` Jeff Garzik
  2009-05-02 17:58   ` Andreas Mohr
  2009-05-02 20:52   ` David Miller
  0 siblings, 2 replies; 6+ messages in thread
From: Jeff Garzik @ 2009-05-02 17:05 UTC (permalink / raw)
  To: Lubomir Rintel; +Cc: netdev, Andrew Morton, Linux Kernel Mailing List, stable

Lubomir Rintel wrote:
> Doing it in reverse order causes uevent to be sent before
> we have a MAC address, which confuses udev.
> 
> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>

Acked-by: Jeff Garzik <jgarzik@redhat.com>

Good spotting, that fixes a clear startup race



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

* Re: [PATCH] Do not register ne2k-pci device until initialized
  2009-05-02 17:05 ` Jeff Garzik
@ 2009-05-02 17:58   ` Andreas Mohr
  2009-05-02 20:52     ` David Miller
  2009-05-03 16:34     ` Krzysztof Halasa
  2009-05-02 20:52   ` David Miller
  1 sibling, 2 replies; 6+ messages in thread
From: Andreas Mohr @ 2009-05-02 17:58 UTC (permalink / raw)
  To: Jeff Garzik
  Cc: Lubomir Rintel, netdev, Andrew Morton, Linux Kernel Mailing List,
	stable

Hi,

> Good spotting, that fixes a clear startup race

I saw this and thought that this must be one of those non-singular bugs
again... ;)

(I checked for dev_addr manipulations _after_ register_netdev)

And, well...:

smsc911x.c looks like it has the same issue (in case of a non-specified
MAC address - invalid EEPROM content).

Dito ucc_geth.c

Dito arm/ixp4xx_eth.c

Dito wireless/netwave_cs.c


Given that several drivers seem to violate this rule: is there a way
to add a check against this problem?

Andreas Mohr

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

* Re: [PATCH] Do not register ne2k-pci device until initialized
  2009-05-02 17:58   ` Andreas Mohr
@ 2009-05-02 20:52     ` David Miller
  2009-05-03 16:34     ` Krzysztof Halasa
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2009-05-02 20:52 UTC (permalink / raw)
  To: andi; +Cc: jeff, lkundrak, netdev, akpm, linux-kernel, stable

From: Andreas Mohr <andi@lisas.de>
Date: Sat, 2 May 2009 19:58:11 +0200

> And, well...:
> 
> smsc911x.c looks like it has the same issue (in case of a non-specified
> MAC address - invalid EEPROM content).
> 
> Dito ucc_geth.c
> 
> Dito arm/ixp4xx_eth.c
> 
> Dito wireless/netwave_cs.c
> 
> Given that several drivers seem to violate this rule: is there a way
> to add a check against this problem?

I'm pretty sure we have a valid ethernet address check
somewhere already... hmmm..

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

* Re: [PATCH] Do not register ne2k-pci device until initialized
  2009-05-02 17:05 ` Jeff Garzik
  2009-05-02 17:58   ` Andreas Mohr
@ 2009-05-02 20:52   ` David Miller
  1 sibling, 0 replies; 6+ messages in thread
From: David Miller @ 2009-05-02 20:52 UTC (permalink / raw)
  To: jeff; +Cc: lkundrak, netdev, akpm, linux-kernel, stable

From: Jeff Garzik <jeff@garzik.org>
Date: Sat, 02 May 2009 13:05:34 -0400

> Lubomir Rintel wrote:
>> Doing it in reverse order causes uevent to be sent before
>> we have a MAC address, which confuses udev.
>> Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
> 
> Acked-by: Jeff Garzik <jgarzik@redhat.com>
> 
> Good spotting, that fixes a clear startup race

Applied, thanks.

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

* Re: [PATCH] Do not register ne2k-pci device until initialized
  2009-05-02 17:58   ` Andreas Mohr
  2009-05-02 20:52     ` David Miller
@ 2009-05-03 16:34     ` Krzysztof Halasa
  1 sibling, 0 replies; 6+ messages in thread
From: Krzysztof Halasa @ 2009-05-03 16:34 UTC (permalink / raw)
  To: Andreas Mohr
  Cc: Jeff Garzik, Lubomir Rintel, netdev, Andrew Morton,
	Linux Kernel Mailing List, stable

Andreas Mohr <andi@lisas.de> writes:

> Dito arm/ixp4xx_eth.c

Right, will have a patch soon (mainline only, IMHO it's not worth it
to bother "stable" people because of no practical impact of this bug,
especially on this ARM IXP4xx arch).

Thanks.
-- 
Krzysztof Halasa

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

end of thread, other threads:[~2009-05-03 16:34 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-02 16:28 [PATCH] Do not register ne2k-pci device until initialized Lubomir Rintel
2009-05-02 17:05 ` Jeff Garzik
2009-05-02 17:58   ` Andreas Mohr
2009-05-02 20:52     ` David Miller
2009-05-03 16:34     ` Krzysztof Halasa
2009-05-02 20:52   ` 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).