[PATCH] DEPCA Network card module unload Oops

From: Peter Denison (peterd@pnd-pc.demon.co.uk)
Date: Fri Aug 10 2001 - 11:18:25 EST


Description:
        The DEPCA/DE100 etc network card driver oopses on unload if
compiled as a module and if CONFIG_NETLINK & CONFIG_RTNETLINK are
defined. This patch fixes the problem.

Detail:
        On network adapter unload, unregister_netdev() calls down the
notifier chain, announcing the unload. If RTNETLINK is compiled in, then
one of the notifications is rtnetlink_event(), eventually calling
rtnetlink_fill_ifinfo(), which does a dev->get_stats(dev). If the stats
call to the driver uses private info, then the call to unregister_netdev()
must happen before the private data is freed. I haven't checked any other
network drivers for this, but it may be worth doing.

Patch:

--- drivers/net/depca.c.old Sun Jul 15 16:43:58 2001
+++ drivers/net/depca.c Wed Aug 8 21:06:45 2001
@@ -2060,6 +2060,8 @@
 cleanup_module(void)
 {
   struct depca_private *lp = thisDepca.priv;
+
+ unregister_netdev(&thisDepca);
   if (lp) {
     iounmap(lp->sh_mem);
 #ifdef CONFIG_MCA
@@ -2071,7 +2073,6 @@
   }
   thisDepca.irq=0;

- unregister_netdev(&thisDepca);
   release_region(thisDepca.base_addr, DEPCA_TOTAL_SIZE);
 }
 #endif /* MODULE */

-- 
Peter Denison <peterd@pnd-pc.demon.co.uk>
Linux Driver for Promise DC4030VL cards.
See http://www.pnd-pc.demon.co.uk/promise/promise.html for details

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Aug 15 2001 - 21:00:34 EST