more on module usage count

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


I was looking at the source of one of the NIC drivers which triggers a
kernel  panic  when  removed  while  generating traffic  and  maybe  I
realized  what should  be  the cause  of  it. I'm  referring to  3c509
driver. Taking a look at the cleanup routine


static void __exit el3_cleanup_module(void)
{
    struct net_device *next_dev;

    while (el3_root_dev) {
        struct el3_private *lp = (struct el3_private *)el3_root_dev->priv;

        next_dev = lp->next_dev;
        el3_common_remove (el3_root_dev);
        el3_root_dev = next_dev;
    }
    [..]


static void el3_common_remove (struct net_device *dev)
{
        struct el3_private *lp = dev->priv;

        (void) lp;              /* Keep gcc quiet... */
#ifdef CONFIG_PM
        if (lp->pmdev)
            pm_unregister(lp->pmdev);
#endif
#if defined(__ISAPNP__) && !defined(CONFIG_X86_PC9800)
        if (lp->type == EL3_PNP)
            pnp_device_detach(to_pnp_dev(lp->dev));
#endif

        unregister_netdev (dev);
        release_region(dev->base_addr, EL3_IO_EXTENT);
        kfree (dev);
}


If a user doesn't shut  down the interface before removing the module,
it's easy to  realize that some problems could occur.  First of all, I
think that before calling  el3_common_remove() in the cleanup routine,
it could be safer to call a netif_stop_queue() on the net device to be
removed. Then,  after the while loop,  I think we should  take care of
releasing the IRQ.

If you think I'm right I could write a patch.

Regards.  

- --

Angelo Dell'Aera 
Antifork Research, Inc.	  	http://buffer.antifork.org

PGP information in e-mail header


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)

iD8DBQE/QiBwpONIzxnBXKIRAkH5AKC0DBAM9HsDdOE67DD2Qhp44cgPYQCgqs+P
FheuUU/a1vBmB9Je/eUFCVw=
=s7YG
-----END PGP SIGNATURE-----
-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux