public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Doug Ledford <dledford@redhat.com>
To: Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Module refcounting in fs/proc/inode.c
Date: Sun, 17 Nov 2002 19:08:16 -0500	[thread overview]
Message-ID: <20021118000816.GN3280@redhat.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 511 bytes --]

This patch should make module ref counting safe in the proc filesystem.  
Without it, accessing /proc/scsi/aic7xxx/0 renders the aic7xxx module 
unloadable.  However, I assume that we can call put_de() on the de we have 
at the time that the module ref inc attempt might fail.  If that's not 
right, then someone who knows de ops will have to correct this patch.



-- 
  Doug Ledford <dledford@redhat.com>     919-754-3700 x44233
         Red Hat, Inc. 
         1801 Varsity Dr.
         Raleigh, NC 27606
  

[-- Attachment #2: proc-inode.patch --]
[-- Type: text/plain, Size: 561 bytes --]

===== fs/proc/inode.c 1.17 vs edited =====
--- 1.17/fs/proc/inode.c	Sat Sep 28 11:36:29 2002
+++ edited/fs/proc/inode.c	Sun Nov 17 18:22:38 2002
@@ -73,7 +73,7 @@
 	de = PROC_I(inode)->pde;
 	if (de) {
 		if (de->owner)
-			__MOD_DEC_USE_COUNT(de->owner);
+			module_put(de->owner);
 		de_put(de);
 	}
 }
@@ -201,7 +201,8 @@
 		if (de->nlink)
 			inode->i_nlink = de->nlink;
 		if (de->owner)
-			__MOD_INC_USE_COUNT(de->owner);
+			if(!try_module_get(de->owner))
+				goto out_fail;
 		if (de->proc_iops)
 			inode->i_op = de->proc_iops;
 		if (de->proc_fops)

                 reply	other threads:[~2002-11-18  0:00 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=20021118000816.GN3280@redhat.com \
    --to=dledford@redhat.com \
    --cc=linux-kernel@vger.kernel.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