]> Pileus Git - ~andy/linux/blobdiff - fs/open.c
ARM: 7839/1: entry: fix tracing of ARM-private syscalls
[~andy/linux] / fs / open.c
index d53e29895082306747de0998c730159b73d08528..2a731b0d08bc456af047ad58ce68c6823f7b1972 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -443,7 +443,7 @@ retry:
                goto dput_and_out;
 
        error = -EPERM;
-       if (!nsown_capable(CAP_SYS_CHROOT))
+       if (!ns_capable(current_user_ns(), CAP_SYS_CHROOT))
                goto dput_and_out;
        error = security_path_chroot(&path);
        if (error)
@@ -485,14 +485,13 @@ out_unlock:
 
 SYSCALL_DEFINE2(fchmod, unsigned int, fd, umode_t, mode)
 {
-       struct file * file;
+       struct fd f = fdget(fd);
        int err = -EBADF;
 
-       file = fget(fd);
-       if (file) {
-               audit_inode(NULL, file->f_path.dentry, 0);
-               err = chmod_common(&file->f_path, mode);
-               fput(file);
+       if (f.file) {
+               audit_inode(NULL, f.file->f_path.dentry, 0);
+               err = chmod_common(&f.file->f_path, mode);
+               fdput(f);
        }
        return err;
 }
@@ -823,7 +822,7 @@ static inline int build_open_flags(int flags, umode_t mode, struct open_flags *o
        int lookup_flags = 0;
        int acc_mode;
 
-       if (flags & O_CREAT)
+       if (flags & (O_CREAT | __O_TMPFILE))
                op->mode = (mode & S_IALLUGO) | S_IFREG;
        else
                op->mode = 0;