]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
userns: rename is_owner_or_cap to inode_owner_or_capable
authorSerge E. Hallyn <serge@hallyn.com>
Wed, 23 Mar 2011 23:43:26 +0000 (16:43 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 24 Mar 2011 02:47:13 +0000 (19:47 -0700)
And give it a kernel-doc comment.

[akpm@linux-foundation.org: btrfs changed in linux-next]
Signed-off-by: Serge E. Hallyn <serge.hallyn@canonical.com>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Daniel Lezcano <daniel.lezcano@free.fr>
Acked-by: David Howells <dhowells@redhat.com>
Cc: James Morris <jmorris@namei.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
30 files changed:
fs/9p/acl.c
fs/attr.c
fs/btrfs/acl.c
fs/btrfs/ioctl.c
fs/ext2/acl.c
fs/ext2/ioctl.c
fs/ext3/acl.c
fs/ext3/ioctl.c
fs/ext4/acl.c
fs/ext4/ioctl.c
fs/fcntl.c
fs/generic_acl.c
fs/gfs2/file.c
fs/hfsplus/ioctl.c
fs/inode.c
fs/jffs2/acl.c
fs/jfs/ioctl.c
fs/jfs/xattr.c
fs/logfs/file.c
fs/namei.c
fs/nilfs2/ioctl.c
fs/ocfs2/acl.c
fs/ocfs2/ioctl.c
fs/reiserfs/ioctl.c
fs/reiserfs/xattr_acl.c
fs/ubifs/ioctl.c
fs/utimes.c
fs/xattr.c
include/linux/fs.h
security/selinux/hooks.c

index 33aa116732c8986a46990c6bad72bf6c784b2b2e..535ab6eccb1a8de6090ff94448a3bf044d1b6514 100644 (file)
@@ -323,7 +323,7 @@ static int v9fs_xattr_set_acl(struct dentry *dentry, const char *name,
 
        if (S_ISLNK(inode->i_mode))
                return -EOPNOTSUPP;
-       if (!is_owner_or_cap(inode))
+       if (!inode_owner_or_capable(inode))
                return -EPERM;
        if (value) {
                /* update the cached acl value */
index 7ca41811afa1147ad764acbd1fe5b5957c883f5d..1007ed6163146e5de5c5e0695ab6f40a6ad8c390 100644 (file)
--- a/fs/attr.c
+++ b/fs/attr.c
@@ -59,7 +59,7 @@ int inode_change_ok(const struct inode *inode, struct iattr *attr)
 
        /* Make sure a caller can chmod. */
        if (ia_valid & ATTR_MODE) {
-               if (!is_owner_or_cap(inode))
+               if (!inode_owner_or_capable(inode))
                        return -EPERM;
                /* Also check the setgid bit! */
                if (!in_group_p((ia_valid & ATTR_GID) ? attr->ia_gid :
@@ -69,7 +69,7 @@ int inode_change_ok(const struct inode *inode, struct iattr *attr)
 
        /* Check for setting the inode time. */
        if (ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET)) {
-               if (!is_owner_or_cap(inode))
+               if (!inode_owner_or_capable(inode))
                        return -EPERM;
        }
 
index 9c949348510b476f776321bbe8f42f3c858c980e..de34bfad9ec3cab33f35ead4f31d9605f48af66c 100644 (file)
@@ -170,7 +170,7 @@ static int btrfs_xattr_acl_set(struct dentry *dentry, const char *name,
        int ret;
        struct posix_acl *acl = NULL;
 
-       if (!is_owner_or_cap(dentry->d_inode))
+       if (!inode_owner_or_capable(dentry->d_inode))
                return -EPERM;
 
        if (!IS_POSIXACL(dentry->d_inode))
index 5fdb2abc4fa789d49db9b76cd4e459d8c0d3bc85..d1bace3df9b61fab21ca50a9e84ff427fedc75ea 100644 (file)
@@ -158,7 +158,7 @@ static int btrfs_ioctl_setflags(struct file *file, void __user *arg)
                      FS_SYNC_FL | FS_DIRSYNC_FL))
                return -EOPNOTSUPP;
 
-       if (!is_owner_or_cap(inode))
+       if (!inode_owner_or_capable(inode))
                return -EACCES;
 
        mutex_lock(&inode->i_mutex);
@@ -1077,7 +1077,7 @@ static noinline int btrfs_ioctl_subvol_setflags(struct file *file,
        if (flags & ~BTRFS_SUBVOL_RDONLY)
                return -EOPNOTSUPP;
 
-       if (!is_owner_or_cap(inode))
+       if (!inode_owner_or_capable(inode))
                return -EACCES;
 
        down_write(&root->fs_info->subvol_sem);
index 7b4180554a62a3c9ce2807487477d93485602bf3..abea5a17c76444edced01a069ccd2ddfc57acc6f 100644 (file)
@@ -406,7 +406,7 @@ ext2_xattr_set_acl(struct dentry *dentry, const char *name, const void *value,
                return -EINVAL;
        if (!test_opt(dentry->d_sb, POSIX_ACL))
                return -EOPNOTSUPP;
-       if (!is_owner_or_cap(dentry->d_inode))
+       if (!inode_owner_or_capable(dentry->d_inode))
                return -EPERM;
 
        if (value) {
index e7431309bdca9b7c873a34718263f14097b81ff5..f81e250ac5c4d62d7616a8f724d30ae8ae9265e7 100644 (file)
@@ -39,7 +39,7 @@ long ext2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                if (ret)
                        return ret;
 
-               if (!is_owner_or_cap(inode)) {
+               if (!inode_owner_or_capable(inode)) {
                        ret = -EACCES;
                        goto setflags_out;
                }
@@ -89,7 +89,7 @@ setflags_out:
        case EXT2_IOC_GETVERSION:
                return put_user(inode->i_generation, (int __user *) arg);
        case EXT2_IOC_SETVERSION:
-               if (!is_owner_or_cap(inode))
+               if (!inode_owner_or_capable(inode))
                        return -EPERM;
                ret = mnt_want_write(filp->f_path.mnt);
                if (ret)
@@ -115,7 +115,7 @@ setflags_out:
                if (!test_opt(inode->i_sb, RESERVATION) ||!S_ISREG(inode->i_mode))
                        return -ENOTTY;
 
-               if (!is_owner_or_cap(inode))
+               if (!inode_owner_or_capable(inode))
                        return -EACCES;
 
                if (get_user(rsv_window_size, (int __user *)arg))
index e4fa49e6c539310c2a4c67de8ae8fb7f647c7ec2..9d021c0d472a3666bc8bf77122a5ed09f877060d 100644 (file)
@@ -435,7 +435,7 @@ ext3_xattr_set_acl(struct dentry *dentry, const char *name, const void *value,
                return -EINVAL;
        if (!test_opt(inode->i_sb, POSIX_ACL))
                return -EOPNOTSUPP;
-       if (!is_owner_or_cap(inode))
+       if (!inode_owner_or_capable(inode))
                return -EPERM;
 
        if (value) {
index fc080dd561f74ecf8b00a48038e8c9f18f4a789e..f4090bd2f345218df867b618806569415c1de688 100644 (file)
@@ -38,7 +38,7 @@ long ext3_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                unsigned int oldflags;
                unsigned int jflag;
 
-               if (!is_owner_or_cap(inode))
+               if (!inode_owner_or_capable(inode))
                        return -EACCES;
 
                if (get_user(flags, (int __user *) arg))
@@ -123,7 +123,7 @@ flags_out:
                __u32 generation;
                int err;
 
-               if (!is_owner_or_cap(inode))
+               if (!inode_owner_or_capable(inode))
                        return -EPERM;
 
                err = mnt_want_write(filp->f_path.mnt);
@@ -192,7 +192,7 @@ setversion_out:
                if (err)
                        return err;
 
-               if (!is_owner_or_cap(inode)) {
+               if (!inode_owner_or_capable(inode)) {
                        err = -EACCES;
                        goto setrsvsz_out;
                }
index e0270d1f8d82b68e8823cccc4db7539fb9a34f5b..21eacd7b7d79f558695b37216f6e9ea4745fb05e 100644 (file)
@@ -433,7 +433,7 @@ ext4_xattr_set_acl(struct dentry *dentry, const char *name, const void *value,
                return -EINVAL;
        if (!test_opt(inode->i_sb, POSIX_ACL))
                return -EOPNOTSUPP;
-       if (!is_owner_or_cap(inode))
+       if (!inode_owner_or_capable(inode))
                return -EPERM;
 
        if (value) {
index eb3bc2fe647e710de889f04da3afaf5821e00556..a84faa110bcda3b0cfdb4992c83cc422766e74be 100644 (file)
@@ -38,7 +38,7 @@ long ext4_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                unsigned int oldflags;
                unsigned int jflag;
 
-               if (!is_owner_or_cap(inode))
+               if (!inode_owner_or_capable(inode))
                        return -EACCES;
 
                if (get_user(flags, (int __user *) arg))
@@ -146,7 +146,7 @@ flags_out:
                __u32 generation;
                int err;
 
-               if (!is_owner_or_cap(inode))
+               if (!inode_owner_or_capable(inode))
                        return -EPERM;
 
                err = mnt_want_write(filp->f_path.mnt);
@@ -298,7 +298,7 @@ mext_out:
        case EXT4_IOC_MIGRATE:
        {
                int err;
-               if (!is_owner_or_cap(inode))
+               if (!inode_owner_or_capable(inode))
                        return -EACCES;
 
                err = mnt_want_write(filp->f_path.mnt);
@@ -320,7 +320,7 @@ mext_out:
        case EXT4_IOC_ALLOC_DA_BLKS:
        {
                int err;
-               if (!is_owner_or_cap(inode))
+               if (!inode_owner_or_capable(inode))
                        return -EACCES;
 
                err = mnt_want_write(filp->f_path.mnt);
index 6c82e5bac03932bf11e154b9c7c9e86b774e93cd..22764c7c8382ce607ca5f9ec9b1a2f48e3d15c4e 100644 (file)
@@ -159,7 +159,7 @@ static int setfl(int fd, struct file * filp, unsigned long arg)
 
        /* O_NOATIME can only be set by the owner or superuser */
        if ((arg & O_NOATIME) && !(filp->f_flags & O_NOATIME))
-               if (!is_owner_or_cap(inode))
+               if (!inode_owner_or_capable(inode))
                        return -EPERM;
 
        /* required for strict SunOS emulation */
index 06c48a89183293b86e25d87329cb2d6aa6e3b775..8f26d1a5891226acc324798ed84bdeb27950145c 100644 (file)
@@ -74,7 +74,7 @@ generic_acl_set(struct dentry *dentry, const char *name, const void *value,
                return -EINVAL;
        if (S_ISLNK(inode->i_mode))
                return -EOPNOTSUPP;
-       if (!is_owner_or_cap(inode))
+       if (!inode_owner_or_capable(inode))
                return -EPERM;
        if (value) {
                acl = posix_acl_from_xattr(value, size);
index 4074b952b059fde1e44efe84d27e5ba17a87a25c..b2682e073eee0a593b1ab43c74291aa08e6af674 100644 (file)
@@ -221,7 +221,7 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
                goto out_drop_write;
 
        error = -EACCES;
-       if (!is_owner_or_cap(inode))
+       if (!inode_owner_or_capable(inode))
                goto out;
 
        error = 0;
index 508ce662ce122b0b5bea34f6f6260ae22ef0a512..fbaa6690c8e0ecd0ecbd49c47b6c182262301fea 100644 (file)
@@ -47,7 +47,7 @@ static int hfsplus_ioctl_setflags(struct file *file, int __user *user_flags)
        if (err)
                goto out;
 
-       if (!is_owner_or_cap(inode)) {
+       if (!inode_owner_or_capable(inode)) {
                err = -EACCES;
                goto out_drop_write;
        }
index a21d5a938a177545e3a866f57bda5052732d6ea1..0b3da4a777042236c69024df1031f32b044e71c9 100644 (file)
@@ -1735,11 +1735,14 @@ void inode_init_owner(struct inode *inode, const struct inode *dir,
 }
 EXPORT_SYMBOL(inode_init_owner);
 
-/*
- * return true if current either has CAP_FOWNER to the
- * file, or owns the file.
+/**
+ * inode_owner_or_capable - check current task permissions to inode
+ * @inode: inode being checked
+ *
+ * Return true if current either has CAP_FOWNER to the inode, or
+ * owns the file.
  */
-bool is_owner_or_cap(const struct inode *inode)
+bool inode_owner_or_capable(const struct inode *inode)
 {
        struct user_namespace *ns = inode_userns(inode);
 
@@ -1749,4 +1752,4 @@ bool is_owner_or_cap(const struct inode *inode)
                return true;
        return false;
 }
-EXPORT_SYMBOL(is_owner_or_cap);
+EXPORT_SYMBOL(inode_owner_or_capable);
index 95b79672150ab7b6159b00e3ca4083b41eaca9c7..828a0e1ea4387c19c91218b1e8d219a3d3b643b1 100644 (file)
@@ -402,7 +402,7 @@ static int jffs2_acl_setxattr(struct dentry *dentry, const char *name,
 
        if (name[0] != '\0')
                return -EINVAL;
-       if (!is_owner_or_cap(dentry->d_inode))
+       if (!inode_owner_or_capable(dentry->d_inode))
                return -EPERM;
 
        if (value) {
index afe222bf300fc90f0931492b45969c1d09fcc9bc..6f98a1866776842c6ff4ab3d217129eec975b192 100644 (file)
@@ -72,7 +72,7 @@ long jfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                if (err)
                        return err;
 
-               if (!is_owner_or_cap(inode)) {
+               if (!inode_owner_or_capable(inode)) {
                        err = -EACCES;
                        goto setflags_out;
                }
index 3fa4c32272dfa16453f4fbe6995354d219cf4d91..24838f1eeee5c0f5093d96fef01c80d1835991ea 100644 (file)
@@ -678,7 +678,7 @@ static int can_set_system_xattr(struct inode *inode, const char *name,
        struct posix_acl *acl;
        int rc;
 
-       if (!is_owner_or_cap(inode))
+       if (!inode_owner_or_capable(inode))
                return -EPERM;
 
        /*
index e86376b87af11d26034188df8d3c2da2bc469587..c2ad7028def4ebf78295a418ab8d49b1bb7ff765 100644 (file)
@@ -196,7 +196,7 @@ long logfs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                if (IS_RDONLY(inode))
                        return -EROFS;
 
-               if (!is_owner_or_cap(inode))
+               if (!inode_owner_or_capable(inode))
                        return -EACCES;
 
                err = get_user(flags, (int __user *)arg);
index dbb45a652ae399e72e8e201ad08152f7673fb70b..fc858b1124c29a3cb0499c931e7ac397ef888530 100644 (file)
@@ -2036,7 +2036,7 @@ static int may_open(struct path *path, int acc_mode, int flag)
        }
 
        /* O_NOATIME can only be set by the owner or superuser */
-       if (flag & O_NOATIME && !is_owner_or_cap(inode))
+       if (flag & O_NOATIME && !inode_owner_or_capable(inode))
                return -EPERM;
 
        /*
index 95c04c2f2b3e06f619e1db52283b750479075296..f2469ba6246bd76458da3ce2b40121dd5f5d7d2b 100644 (file)
@@ -113,7 +113,7 @@ static int nilfs_ioctl_setflags(struct inode *inode, struct file *filp,
        unsigned int flags, oldflags;
        int ret;
 
-       if (!is_owner_or_cap(inode))
+       if (!inode_owner_or_capable(inode))
                return -EACCES;
 
        if (get_user(flags, (int __user *)argp))
index 704f6b1742f3204ddf9eae9bb0ebbdfd0e1fcace..90f2729b7a5bc031e778fad1cf4b665409394247 100644 (file)
@@ -497,7 +497,7 @@ static int ocfs2_xattr_set_acl(struct dentry *dentry, const char *name,
        if (!(osb->s_mount_opt & OCFS2_MOUNT_POSIX_ACL))
                return -EOPNOTSUPP;
 
-       if (!is_owner_or_cap(inode))
+       if (!inode_owner_or_capable(inode))
                return -EPERM;
 
        if (value) {
index 7a48681961521a957e1947ba9abdbb8d290f9cde..09de77ce002ab0f68e9e0783521f5eba3f6ae056 100644 (file)
@@ -82,7 +82,7 @@ static int ocfs2_set_inode_attr(struct inode *inode, unsigned flags,
        }
 
        status = -EACCES;
-       if (!is_owner_or_cap(inode))
+       if (!inode_owner_or_capable(inode))
                goto bail_unlock;
 
        if (!S_ISDIR(inode->i_mode))
index 79265fdc317a09889c6ce3c2343bb17594bce40e..4e153051bc75bf691f2352c8bf3c177613195f40 100644 (file)
@@ -59,7 +59,7 @@ long reiserfs_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
                        if (err)
                                break;
 
-                       if (!is_owner_or_cap(inode)) {
+                       if (!inode_owner_or_capable(inode)) {
                                err = -EPERM;
                                goto setflags_out;
                        }
@@ -103,7 +103,7 @@ setflags_out:
                err = put_user(inode->i_generation, (int __user *)arg);
                break;
        case REISERFS_IOC_SETVERSION:
-               if (!is_owner_or_cap(inode)) {
+               if (!inode_owner_or_capable(inode)) {
                        err = -EPERM;
                        break;
                }
index 90d2fcb67a314633a4f3855dc08e057a43390a40..3dc38f1206fc06a6757521a399263edca7d1f844 100644 (file)
@@ -26,7 +26,7 @@ posix_acl_set(struct dentry *dentry, const char *name, const void *value,
        size_t jcreate_blocks;
        if (!reiserfs_posixacl(inode->i_sb))
                return -EOPNOTSUPP;
-       if (!is_owner_or_cap(inode))
+       if (!inode_owner_or_capable(inode))
                return -EPERM;
 
        if (value) {
index 8aacd64957a223c0a01e2d9c54dd73c9d7fbd409..548acf494afd1720a4181e4dbd6861970b24ab34 100644 (file)
@@ -160,7 +160,7 @@ long ubifs_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                if (IS_RDONLY(inode))
                        return -EROFS;
 
-               if (!is_owner_or_cap(inode))
+               if (!inode_owner_or_capable(inode))
                        return -EACCES;
 
                if (get_user(flags, (int __user *) arg))
index 179b586906573a444561a892e906d2f5b02963e8..ba653f3dc1bc9c66010290e53e0bb2a5b8fd94b1 100644 (file)
@@ -95,7 +95,7 @@ static int utimes_common(struct path *path, struct timespec *times)
                 if (IS_IMMUTABLE(inode))
                        goto mnt_drop_write_and_out;
 
-               if (!is_owner_or_cap(inode)) {
+               if (!inode_owner_or_capable(inode)) {
                        error = inode_permission(inode, MAY_WRITE);
                        if (error)
                                goto mnt_drop_write_and_out;
index 01bb8135e14aafcc4b8782b749374e6b79049afc..a19acdb81cd1270c174711c851b17013edb9ca80 100644 (file)
@@ -59,7 +59,7 @@ xattr_permission(struct inode *inode, const char *name, int mask)
                if (!S_ISREG(inode->i_mode) && !S_ISDIR(inode->i_mode))
                        return -EPERM;
                if (S_ISDIR(inode->i_mode) && (inode->i_mode & S_ISVTX) &&
-                   (mask & MAY_WRITE) && !is_owner_or_cap(inode))
+                   (mask & MAY_WRITE) && !inode_owner_or_capable(inode))
                        return -EPERM;
        }
 
index 9eebc646d14a45989902d2995e82ee62a178a974..4dda076c24a1efac5119988ba915bf0277c2ecf5 100644 (file)
@@ -1463,7 +1463,7 @@ enum {
  */
 extern struct user_namespace init_user_ns;
 #define inode_userns(inode) (&init_user_ns)
-extern bool is_owner_or_cap(const struct inode *inode);
+extern bool inode_owner_or_capable(const struct inode *inode);
 
 /* not quite ready to be deprecated, but... */
 extern void lock_super(struct super_block *);
index c67f863d3546e2ebc9a31a6f8a494335fe51275a..f9c3764e48590e5737a0afddb63043b25675f23b 100644 (file)
@@ -2725,7 +2725,7 @@ static int selinux_inode_setxattr(struct dentry *dentry, const char *name,
        if (!(sbsec->flags & SE_SBLABELSUPP))
                return -EOPNOTSUPP;
 
-       if (!is_owner_or_cap(inode))
+       if (!inode_owner_or_capable(inode))
                return -EPERM;
 
        COMMON_AUDIT_DATA_INIT(&ad, FS);