[PATCH] mod->can_unload() does not take effect

From: $B5HF#1QL@(
Date: Sat Oct 19 2002 - 12:51:01 EST


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
diff -u -r1.1.1.11 module.c
--- kernel/module.c 23 Nov 2001 16:44:45 -0000 1.1.1.11
+++ kernel/module.c 19 Oct 2002 17:34:39 -0000
@@ -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 <kaos@ocs.com.au> Oct 2000
  * Add a module list lock for kernel fault race fixing. Alan Cox <alan@redhat.com>
+ * Fix to respect mod->can_unload(). YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org>
  *
  * 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);
                 }

-- 
Hideaki YOSHIFUJI @ USAGI Project <yoshfuji@linux-ipv6.org>
GPG FP: 9022 65EB 1ECF 3AD1 0BDF  80D8 4807 F894 E062 0EEA
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed Oct 23 2002 - 22:00:47 EST