Messages in this thread Patch in this message | | | Date | Wed, 14 Apr 2004 12:43:55 +0100 (BST) | From | Hugh Dickins <> | 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/
| |