[PATCH] Linking into 2.4 kernel

Pavel Roskin proski at gnu.org
Wed May 14 19:41:43 EDT 2003


Hello!

__MOD_DEC_USE_COUNT and __MOD_INC_USE_COUNT should not be called if MODULE
is not defined, i.e. when the module is compiled into the kernel.  For
2.4 kernels this causes kernel oops when the interface is being brought
up.  Thanks to Christian Lauterbach for reporting this bug.

A minimal patch is attached.

A better solution would be to use SET_MODULE_OWNER(dev) and let the
network code lock and unlock the modules.  That's what the orinoco driver
does for both 2.4 and 2.5 kernels.

However, this may break 2.2 kernels and I don't have time and desire to
handle 2.2, 2.4 and 2.5 kernels separately and test the new code with all
of them.

-- 
Regards,
Pavel Roskin
-------------- next part --------------
--- hostap.c
+++ hostap.c
@@ -681,7 +681,7 @@ static int prism2_close(struct net_devic
 
 #ifdef NEW_MODULE_CODE
 	module_put(local->hw_module);
-#else
+#elif MODULE
 	__MOD_DEC_USE_COUNT(local->hw_module);
 #endif
 
@@ -701,7 +701,7 @@ static int prism2_open(struct net_device
 #ifdef NEW_MODULE_CODE
 	if (!try_module_get(local->hw_module))
 		return -ENODEV;
-#else
+#elif MODULE
 	__MOD_INC_USE_COUNT(local->hw_module);
 #endif
 


More information about the HostAP mailing list