lkml.org 
[lkml]   [2004]   [Apr]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] umount after bad chdir
After chdir (or chroot) to non-existent directory on 2.6.5-mm5, you
can no longer unmount filesystem holding working directory (or root).

--- 2.6.5-mm5/fs/open.c 2004-04-13 11:02:25.000000000 +0100
+++ linux/fs/open.c 2004-04-14 12:23:26.633056368 +0100
@@ -517,13 +517,16 @@ asmlinkage long sys_chdir(const char __u
{
struct nameidata nd;
int error;
- struct vfsmount *old_mnt = mntget(current->fs->pwdmnt);
- struct dentry *old_dentry = dget(current->fs->pwd);
+ struct vfsmount *old_mnt;
+ struct dentry *old_dentry;

error = __user_walk(filename, LOOKUP_FOLLOW|LOOKUP_DIRECTORY, &nd);
if (error)
goto out;

+ old_mnt = mntget(current->fs->pwdmnt);
+ old_dentry = dget(current->fs->pwd);
+
error = permission(nd.dentry->d_inode,MAY_EXEC,&nd);
if (error)
goto dput_and_out;
@@ -590,13 +593,16 @@ asmlinkage long sys_chroot(const char __
{
struct nameidata nd;
int error;
- struct vfsmount *old_mnt = mntget(current->fs->rootmnt);
- struct dentry *old_dentry = dget(current->fs->root);
+ struct vfsmount *old_mnt;
+ struct dentry *old_dentry;

error = __user_walk(filename, LOOKUP_FOLLOW | LOOKUP_DIRECTORY | LOOKUP_NOALT, &nd);
if (error)
goto out;

+ old_mnt = mntget(current->fs->pwdmnt);
+ old_dentry = dget(current->fs->pwd);
+
error = permission(nd.dentry->d_inode,MAY_EXEC,&nd);
if (error)
goto dput_and_out;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:02    [W:0.252 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site