Hi Paul,
I noticed that ne2k-pci doesn't properly increase/decrease the module
use counts before sleeping, that's a potential race.
I've tested the attached patch with 2.3.44, could you add it to the
ne2k-pci driver?
e.g. request_irq() allocates memory, thus it can sleep, and while it
sleeps the kernel could unload the ne2k-pci module -> oops when
request_irq() returns.
I'm not subscribed to linux-net, please cc any replies,
--
Manfred
--- 2.3/drivers/net/ne2k-pci.c Thu Feb 10 22:38:59 2000
+++ build-2.3/drivers/net/ne2k-pci.c Sun Feb 13 11:31:48 2000
@@ -135,11 +135,16 @@
if (debug)
printk(KERN_INFO "%s", version);
+ if (load_8390_module("ne2k-pci.c"))
+ return -EINVAL;
+
+ lock_8390_module();
+
if (ne2k_pci_probe()) {
printk(KERN_NOTICE "ne2k-pci.c: No useable cards found, driver NOT
installed.\n");
+ unlock_8390_module();
return -ENODEV;
}
- lock_8390_module();
return 0;
}
@@ -304,10 +309,6 @@
outb(0xff, ioaddr + EN0_ISR); /* Ack all intr. */
}
- if (load_8390_module("ne2k-pci.c")) {
- return 0;
- }
-
/* Read the 16 bytes of station address PROM.
We must first initialize registers, similar to NS8390_init(eifdev, 0).
We can't reliably read the SAPROM address without this.
@@ -393,10 +394,12 @@
static int
ne2k_pci_open(struct net_device *dev)
{
- if (request_irq(dev->irq, ei_interrupt, SA_SHIRQ, dev->name, dev))
+ MOD_INC_USE_COUNT;
+ if (request_irq(dev->irq, ei_interrupt, SA_SHIRQ, dev->name, dev)) {
+ MOD_DEC_USE_COUNT;
return -EAGAIN;
+ }
ei_open(dev);
- MOD_INC_USE_COUNT;
return 0;
}