Received: with ECARTIS (v1.0.0; list netdev); Mon, 09 Jun 2003 10:10:39 -0700 (PDT) Received: from mail.osdl.org (air-2.osdl.org [65.172.181.6]) by oss.sgi.com (8.12.9/8.12.9) with SMTP id h59HAU2x005409; Mon, 9 Jun 2003 10:10:30 -0700 Received: from dell_ss3.pdx.osdl.net (dell_ss3.pdx.osdl.net [172.20.1.60]) by mail.osdl.org (8.11.6/8.11.6) with SMTP id h59HAJX22232; Mon, 9 Jun 2003 10:10:19 -0700 Date: Mon, 9 Jun 2003 10:10:18 -0700 From: Stephen Hemminger To: "David S. Miller" Cc: ralf@oss.sgi.com, jgarzik@pobox.com, netdev@oss.sgi.com Subject: Re: [BUG] drivers/net/ioc3_eth.c in 2.5 Message-Id: <20030609101018.0ca2e1f9.shemminger@osdl.org> In-Reply-To: <20030607.013010.116359540.davem@redhat.com> References: <20030606161658.1f01b8f9.shemminger@osdl.org> <20030607.013010.116359540.davem@redhat.com> Organization: Open Source Development Lab X-Mailer: Sylpheed version 0.8.11 (GTK+ 1.2.10; i686-pc-linux-gnu) X-Face: &@E+xe?c%:&e4D{>f1O<&U>2qwRREG5!}7R4;D<"NO^UI2mJ[eEOA2*3>(`Th.yP,VDPo9$ /`~cw![cmj~~jWe?AHY7D1S+\}5brN0k*NE?pPh_'_d>6;XGG[\KDRViCfumZT3@[ Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-archive-position: 3012 X-ecartis-version: Ecartis v1.0.0 Sender: netdev-bounce@oss.sgi.com Errors-to: netdev-bounce@oss.sgi.com X-original-sender: shemminger@osdl.org Precedence: bulk X-list: netdev On Sat, 07 Jun 2003 01:30:10 -0700 (PDT) "David S. Miller" wrote: > From: Stephen Hemminger > Date: Fri, 6 Jun 2003 16:16:58 -0700 > > This driver never calls unregister in it's module exit function: > > static void __exit ioc3_cleanup_module(void) > { > pci_unregister_driver(&ioc3_driver); > } > > pci_unregister_driver() invokes, for each PCI driver instance > registered, the ->remove() method for that driver. > > What is the problem? tg3.c and many other drivers work exactly > like this, using the PCI registry mechanism as a helper to do > all the grunge work or device iteration. pci_unregister_driver does the iteration but not the net device cleanup. The problem is the driver never calls unregister_netdev, it just free's the device structure. If this ever happens, the net device list would be corrupt. Don't have the hardware to actually do this though. Looks like the right fix is: --- ioc3-eth.c.orig 2003-06-09 10:05:45.000000000 -0700 +++ ioc3-eth.c 2003-06-09 10:04:45.000000000 -0700 @@ -1614,6 +1614,7 @@ static void __devexit ioc3_remove_one (s struct ioc3 *ioc3 = ip->regs; iounmap(ioc3); + unregister_netdev(dev); pci_release_regions(pdev); kfree(dev); }