mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-31 04:01:48 -04:00
Merge branch 'work.sane_pwd' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
Pull misc vfs updates from Al Viro: "Making sure that something like a referral point won't end up as pwd or root. The main part is the last commit (fixing mntns_install()); that one fixes a hard-to-hit race. The fchdir() commit is making fchdir(2) a bit more robust - it should be impossible to get opened files (even O_PATH ones) for referral points in the first place, so the existing checks are OK, but checking the same thing as in chdir(2) is just as cheap. The path_init() commit removes a redundant check that shouldn't have been there in the first place" * 'work.sane_pwd' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: make sure that mntns_install() doesn't end up with referral for root path_init(): don't bother with checking MAY_EXEC for LOOKUP_ROOT make sure that fchdir() won't accept referral points, etc.
This commit is contained in:
commit
050453295f
4 changed files with 55 additions and 21 deletions
|
|
@ -460,20 +460,17 @@ out:
|
|||
SYSCALL_DEFINE1(fchdir, unsigned int, fd)
|
||||
{
|
||||
struct fd f = fdget_raw(fd);
|
||||
struct inode *inode;
|
||||
int error = -EBADF;
|
||||
int error;
|
||||
|
||||
error = -EBADF;
|
||||
if (!f.file)
|
||||
goto out;
|
||||
|
||||
inode = file_inode(f.file);
|
||||
|
||||
error = -ENOTDIR;
|
||||
if (!S_ISDIR(inode->i_mode))
|
||||
if (!d_can_lookup(f.file->f_path.dentry))
|
||||
goto out_putf;
|
||||
|
||||
error = inode_permission(inode, MAY_EXEC | MAY_CHDIR);
|
||||
error = inode_permission(file_inode(f.file), MAY_EXEC | MAY_CHDIR);
|
||||
if (!error)
|
||||
set_fs_pwd(current->fs, &f.file->f_path);
|
||||
out_putf:
|
||||
|
|
|
|||
Loading…
Reference in a new issue