From: Maneesh Soni <maneesh@in.ibm.com>
To: Al Viro <viro@parcelfarce.linux.theplanet.co.uk>
Cc: LKML <linux-kernel@vger.kernel.org>,
Dipankar Sarma <dipankar@in.ibm.com>,
Andrew Morton <akpm@osdl.org>
Subject: [PATCH 2.6] proc_check_dir-locking-fix
Date: Wed, 28 Jan 2004 10:50:38 +0530 [thread overview]
Message-ID: <20040128052038.GB1285@in.ibm.com> (raw)
Please have a look at the following patch fixing locking in proc_check_root().
It brings is_subdir() call under vfsmount_lock. Holding vfsmount_lock will
ensure mnt_mountpoint dentry is intact and the dentry does not go away while
it is being checked in is_subdir().
fs/proc/base.c | 7 +++----
1 files changed, 3 insertions(+), 4 deletions(-)
diff -puN fs/proc/base.c~proc_check_root-fix-locking fs/proc/base.c
--- linux-2.6.2-rc2/fs/proc/base.c~proc_check_root-fix-locking 2004-01-27 22:28:07.000000000 +0530
+++ linux-2.6.2-rc2-maneesh/fs/proc/base.c 2004-01-27 22:28:07.000000000 +0530
@@ -425,17 +425,15 @@ static int proc_check_root(struct inode
mnt = vfsmnt;
while (vfsmnt != our_vfsmnt) {
- if (vfsmnt == vfsmnt->mnt_parent) {
- spin_unlock(&vfsmount_lock);
+ if (vfsmnt == vfsmnt->mnt_parent)
goto out;
- }
de = vfsmnt->mnt_mountpoint;
vfsmnt = vfsmnt->mnt_parent;
}
- spin_unlock(&vfsmount_lock);
if (!is_subdir(de, base))
goto out;
+ spin_unlock(&vfsmount_lock);
exit:
dput(base);
@@ -444,6 +442,7 @@ exit:
mntput(mnt);
return res;
out:
+ spin_unlock(&vfsmount_lock);
res = -EACCES;
goto exit;
}
_
--
Maneesh Soni
Linux Technology Center,
IBM Software Lab, Bangalore, India
email: maneesh@in.ibm.com
Phone: 91-80-5044999 Fax: 91-80-5268553
T/L : 9243696
reply other threads:[~2004-01-28 5:16 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=20040128052038.GB1285@in.ibm.com \
--to=maneesh@in.ibm.com \
--cc=akpm@osdl.org \
--cc=dipankar@in.ibm.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®