[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Sun, 9 Sep 2007 20:46:14 +0100 (BST)
From: Chris Rankin <rankincj@...oo.com>
To: netdev@...r.kernel.org
Subject: ne driver crashes when unloaded in 2.6.22.6
Hi,
While trying to get my NE2000 ISA card working with NetworkManager and Linux 2.6.22.6, I
discovered that the ne module will cause the kernel to oops when it is unloaded. The problem is
that the module's clean-up function tries to unregister a platform driver unconditionally,
although the platform driver may never have been registered in the first place. I have created a
patch which seems to work OK. The idea behind the patch is to de-initialise the unregistered
ne_driver structure to the point where the unregister function will abort without error:
--- drivers/net/ne.c.orig 2007-07-21 17:00:52.000000000 +0100
+++ drivers/net/ne.c 2007-09-09 20:04:28.000000000 +0100
@@ -272,6 +272,7 @@
pnp_device_detach(idev);
return -ENXIO;
}
+ SET_NETDEV_DEV(dev, &idev->dev);
ei_status.priv = (unsigned long)idev;
break;
}
@@ -827,6 +828,7 @@
free_netdev(dev);
return err;
}
+ SET_NETDEV_DEV(dev, &pdev->dev);
platform_set_drvdata(pdev, dev);
return 0;
}
@@ -909,11 +911,14 @@
is at boot) and so the probe will get confused by any other 8390 cards.
ISA device autoprobes on a running machine are not recommended anyway. */
int __init init_module(void)
{
int this_dev, found = 0;
int plat_found = !ne_init();
+ if ( !plat_found )
+ ne_driver.driver.bus = NULL;
+
for (this_dev = 0; this_dev < MAX_NE_CARDS; this_dev++) {
struct net_device *dev = alloc_ei_netdev();
if (!dev)
The patch also contains a few SET_NETDEV_DEV() statements, which I am hoping will help these
network cards work with NetworkManager. This isn't a complete solution because it still doesn't
address the non-PnP ISA case. However, I think it's a start... At the moment, my eth device
appears in /sys/class/net but is also completely ignored by lshal.
Cheers,
Chris
___________________________________________________________
Want ideas for reducing your carbon footprint? Visit Yahoo! For Good http://uk.promotions.yahoo.com/forgood/environment.html
-
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Powered by blists - more mailing lists