From: Maneesh Soni <maneesh@in.ibm.com>
To: Greg KH <greg@kroah.com>,
Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Cc: Andrew Morton <akpm@osdl.org>,
Dipankar Sarma <dipankar@in.ibm.com>,
LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 2.6] Fix dentry refcounting in sysfs_remove_group()
Date: Tue, 17 Feb 2004 12:54:36 +0530 [thread overview]
Message-ID: <20040217072436.GB5459@in.ibm.com> (raw)
Hello,
Please review the following patch fixing the dentry refcounting during
sysfs_remove_group().
Thanks
Maneesh
o The following patch fixes the dentry refcounting, during sysfs_remove_group()
and also adds the missing dput() for the "extra" ref taken during
sysfs_create() for the sub-directory dentry corresponding to attribute group.
fs/sysfs/dir.c | 2 ++
fs/sysfs/group.c | 5 +++--
2 files changed, 5 insertions(+), 2 deletions(-)
diff -puN fs/sysfs/dir.c~sysfs_remove_subdir-dentry-leak-fix fs/sysfs/dir.c
--- linux-2.6.3-rc4/fs/sysfs/dir.c~sysfs_remove_subdir-dentry-leak-fix 2004-02-17 11:48:24.000000000 +0530
+++ linux-2.6.3-rc4-maneesh/fs/sysfs/dir.c 2004-02-17 11:54:11.000000000 +0530
@@ -96,6 +96,8 @@ static void remove_dir(struct dentry * d
void sysfs_remove_subdir(struct dentry * d)
{
remove_dir(d);
+ /* release the "extra" ref taken during sysfs_create() */
+ dput(d);
}
diff -puN fs/sysfs/group.c~sysfs_remove_subdir-dentry-leak-fix fs/sysfs/group.c
--- linux-2.6.3-rc4/fs/sysfs/group.c~sysfs_remove_subdir-dentry-leak-fix 2004-02-17 11:48:59.000000000 +0530
+++ linux-2.6.3-rc4-maneesh/fs/sysfs/group.c 2004-02-17 11:49:37.000000000 +0530
@@ -68,12 +68,13 @@ void sysfs_remove_group(struct kobject *
if (grp->name)
dir = sysfs_get_dentry(kobj->dentry,grp->name);
else
- dir = kobj->dentry;
+ dir = dget(kobj->dentry);
remove_files(dir,grp);
- dput(dir);
if (grp->name)
sysfs_remove_subdir(dir);
+ /* release the ref. taken in this routine */
+ dput(dir);
}
_
--
Maneesh Soni
Linux Technology Center,
IBM Software Lab, Bangalore, India
email: maneesh@in.ibm.com
Phone: 91-80-25044999 Fax: 91-80-5268553
T/L : 9243696
reply other threads:[~2004-02-17 7:21 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=20040217072436.GB5459@in.ibm.com \
--to=maneesh@in.ibm.com \
--cc=akpm@osdl.org \
--cc=dipankar@in.ibm.com \
--cc=greg@kroah.com \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@parcelfarce.linux.theplanet.co.uk \
/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®