proc_check_dir-locking-fix
PATCH 1/1 proc_check_dir-locking-fix
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(-)
fs/proc/base.c renamed from fs/proc/base.c~proc_check_root-fix-locking +3 -4
@@ -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; }
_
Signature · 6 lines
Maneesh Soni Linux Technology Center, IBM Software Lab, Bangalore, India email: [email protected] Phone: 91-80-5044999 Fax: 91-80-5268553 T/L : 9243696