Skip to contentSkip to conversation

module locking for pcnet_cs

PATCH Jochen Hein 1 participant 1 message Dec 28, 2002 Network drivers

lore
Share & tools
lore
#0 lore raw

I got the "unsafe" module init message von pcnet_cs and decided to evaluate it. When I remove the MOD_INC_USE_COUNT and MOD_DEC_USE_COUNT[1] the message vanishes. Bad news is that removing the module with still active eth0 loops rmmod (removing after "ifconfig eth0 down" works as expected).

Use count in lsmod is zero, so I think it is not that correct. Playing[2] with try_module_get() doesn't help me either.

Jochen

[1] This is the probably broken patch:

drivers/net/pcmcia/pcnet_cs.c renamed from drivers/net/pcmcia/pcnet_cs.c.jh +0 -3
@@ -1030,7 +1030,6 @@
 	return -ENODEV;
 
     link->open++;
-    MOD_INC_USE_COUNT;
 
     set_misc_reg(dev);
     request_irq(dev->irq, ei_irq_wrapper, SA_SHIRQ, dev_info, dev);
@@ -1064,8 +1063,6 @@
     if (link->state & DEV_STALE_CONFIG)
 	mod_timer(&link->release, jiffies + HZ/20);
 
-    MOD_DEC_USE_COUNT;
-
     return 0;
 } /* pcnet_close */
 

[2] Yet another broken patch:

drivers/net/pcmcia/pcnet_cs.c renamed from drivers/net/pcmcia/pcnet_cs.c.jh +2 -2
@@ -1029,8 +1029,8 @@
     if (!DEV_OK(link))
 	return -ENODEV;
 
+    try_module_get(dev->owner);
     link->open++;
-    MOD_INC_USE_COUNT;
 
     set_misc_reg(dev);
     request_irq(dev->irq, ei_irq_wrapper, SA_SHIRQ, dev_info, dev);
@@ -1064,7 +1064,7 @@
     if (link->state & DEV_STALE_CONFIG)
 	mod_timer(&link->release, jiffies + HZ/20);
 
-    MOD_DEC_USE_COUNT;
+    module_put(dev->owner);
 
     return 0;
 } /* pcnet_close */
Signature · 1 line
#include <~/.signature>: permission denied