Skip to contentSkip to conversation

mod->can_unload() does not take effect

PATCH New YOSHIFUJI Hideaki / 吉藤英明 1 participant 1 message Oct 19, 2002

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mod->can_unload() does not take effect

Hi.

mod->can_unload() does not take effect because it is not called.

This patch is against linux-2.4.19.

Thanks in advance.

Index: kernel/module.c
===================================================================
RCS file: /cvsroot/usagi/usagi/kernel/linux24/kernel/module.c,v retrieving revision 1.1.1.11

module.c +4 -2
diff -u -r1.1.1.11 module.c
@@ -25,6 +25,7 @@
  *     http://www.uwsg.iu.edu/hypermail/linux/kernel/0008.3/0379.html
  * Replace xxx_module_symbol with inter_module_xxx.  Keith Owens <[email protected]> Oct 2000
  * Add a module list lock for kernel fault race fixing. Alan Cox <[email protected]>
+ * Fix to respect mod->can_unload(). YOSHIFUJI Hideaki <[email protected]>
  *
  * This source is covered by the GNU GPL, the same as all kernel sources.
  */
@@ -867,7 +868,8 @@
 		/* usecount is one too high here - report appropriately to
 		   compensate for locking */
 		info.usecount = (mod_member_present(mod, can_unload)
-				 && mod->can_unload ? -1 : atomic_read(&mod->uc.usecount)-1);
+				 && mod->can_unload && mod->can_unload() 
+				 ? -1 : atomic_read(&mod->uc.usecount)-1);
 
 		if (copy_to_user(buf, &info, sizeof(struct module_info)))
 			return -EFAULT;
@@ -1111,7 +1113,7 @@
 		if (mod->flags & MOD_RUNNING) {
 			len = sprintf(tmpstr, "%4ld",
 				      (mod_member_present(mod, can_unload)
-				       && mod->can_unload
+				       && mod->can_unload && mod->can_unload()
 				       ? -1L : (long)atomic_read(&mod->uc.usecount)));
 			safe_copy_str(tmpstr, len);
 		}
Signature · 2 lines
Hideaki YOSHIFUJI @ USAGI Project <[email protected]>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA