mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "YOSHIFUJI Hideaki / 吉藤英明" <yoshfuji@linux-ipv6.org>
To: linux-kernel@vger.kernel.org
Cc: usagi@linux-ipv6.org
Subject: [PATCH] mod->can_unload() does not take effect
Date: Sun, 20 Oct 2002 02:51:01 +0900 (JST)	[thread overview]
Message-ID: <20021020.025101.53139005.yoshfuji@linux-ipv6.org> (raw)

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

                 reply	other threads:[~2002-10-19 17:44 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20021020.025101.53139005.yoshfuji@linux-ipv6.org \
    --to=yoshfuji@linux-ipv6.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=usagi@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®