Re: Removing MOD_xxx_USE_COUNT from net drivers

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

 



On Wed, 18 Oct 2000 00:42:54 -0400, 
Paul Gortmaker <p_gortmaker@yahoo.com> wrote:
>As an alternative to sprinkling MOD_DEC_USE_COUNT throughout the failure
>paths of each net driver init sequence, maybe we should get the module use 
>counters out of the drivers entirely.  The driver source(s) look cleaner

IOW, exactly what AL Viro did for VFS.

> 	/*
>+	 *	Make sure module is marked in 
>+	 *	use in case dev->open sleeps.
>+	 */
>+
>+	if (dev->module)
>+		__MOD_INC_USE_COUNT(dev->module);

That needs to be try_inc_mod_count with a test on the result to close
this race

  if (dev->module)                          rmmod
                                            usercount == 0, OK to unload
     __MOD_INC_USE_COUNT(dev->module);
                                            unload
  dev->open(), oops

There is a problem with devices, you can ioctl a device without having
a corresponding open().

# strace ifconfig eth0 promisc
execve("/sbin/ifconfig", ["ifconfig", "eth0", "promisc"], [/* 33 vars */]) = 0
.....
socket(PF_INET, SOCK_DGRAM, IPPROTO_IP) = 4
.....
ioctl(4, SIOCGIFFLAGS, 0xbffffa64)      = 0

No open on the device so no use count, what keeps the mod count up to
prevent unloading?

-
: 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