netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* E1000: bug on error path in e1000_probe()
@ 2006-08-01 15:16 Stephane Doyon
  2006-08-01 18:54 ` Auke Kok
  0 siblings, 1 reply; 3+ messages in thread
From: Stephane Doyon @ 2006-08-01 15:16 UTC (permalink / raw)
  To: linux.nics, netdev

Hi,

The e1000_probe() function passes references to the netdev structure 
before it's actually registered. In the (admittedly obscure) case where 
the netdev registration fails, we are left with a dangling reference.

Specifically, e1000_probe() calls
         netif_carrier_off(netdev);
before register_netdev(netdev).

(It also calls pci_set_drvdata(pdev, netdev) rather early, not sure how 
important that is.)

netif_carrier_off() does linkwatch_fire_event(dev);, which in turn does 
dev_hold(dev); and queues up an event with a reference to the netdev.

But the net_device reference counting mechanism only works on registered 
netdevs.

Should the register_netdev() call fail, the error path does 
free_netdev(netdev);, and when the event goes off, it accesses random 
memory through the dangling reference.

I would recommend moving the register_netdev() call earlier.

Thanks


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

end of thread, other threads:[~2006-08-01 19:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-01 15:16 E1000: bug on error path in e1000_probe() Stephane Doyon
2006-08-01 18:54 ` Auke Kok
2006-08-01 19:29   ` Stephane Doyon

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