Re: Locking Between User Context and Soft IRQs in 2.4.0

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

 



On Sun, 05 Nov 2000 12:28:55 +1100, 
Andrew Morton <andrewm@uow.edu.au> wrote:
>          CPU0                              CPU1
>
>        rtnl_lock()
>         dev_ifsioc()
>          dev_change_flags()
>           dev_open();
>            dev->open();
>            vortex_open()
>                                        sys_delete_module()
>                                        if (!__MOD_IN_USE)
>                                         free_module()

If dev->open() calls try_inc_use_count() before it enters the module
you will lock out concurrent module unload via module unload_lock.
There is no need for another module semaphore.

Also there is no need to test dev->owner, try_inc_use_count() already
does that.

        /*
         *      Call device private open method
         */

	ret = -ENODEV;
	if (try_inc_mod_count(dev->owner)) {
		if (dev->open && (ret = dev->open(dev)) && dev->owner)
			__MOD_DEC_USE_COUNT(dev->owner);
	}

In dev_close()

        /*
         *      Call device private close method
         */

	if (dev->owner)
		__MOD_DEC_USE_COUNT(dev->owner);

-
: send the line "unsubscribe linux-net" in
the body of a message to majordomo@vger.kernel.org


[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