]> git.karo-electronics.de Git - linux-beck.git/commitdiff
->permission() sanitizing: pass MAY_NOT_BLOCK to ->check_acl()
authorAl Viro <viro@zeniv.linux.org.uk>
Mon, 20 Jun 2011 23:06:22 +0000 (19:06 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Wed, 20 Jul 2011 05:43:19 +0000 (01:43 -0400)
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
13 files changed:
fs/9p/acl.c
fs/btrfs/acl.c
fs/ext2/acl.c
fs/ext3/acl.c
fs/ext4/acl.c
fs/generic_acl.c
fs/gfs2/acl.c
fs/jffs2/acl.c
fs/jfs/acl.c
fs/namei.c
fs/ocfs2/acl.c
fs/reiserfs/xattr.c
fs/xfs/linux-2.6/xfs_acl.c

index 535ab6eccb1a8de6090ff94448a3bf044d1b6514..94af68b092aff3237c395e204fa5edace2d5b93f 100644 (file)
@@ -101,7 +101,7 @@ int v9fs_check_acl(struct inode *inode, int mask, unsigned int flags)
        struct posix_acl *acl;
        struct v9fs_session_info *v9ses;
 
-       if (flags & IPERM_FLAG_RCU)
+       if (mask & MAY_NOT_BLOCK)
                return -ECHILD;
 
        v9ses = v9fs_inode2v9ses(inode);
index f66fc99597331383890ac4847329faf6a494ddb0..a25a4a2e0df21206b75cb355465c5cbd78851f2c 100644 (file)
@@ -199,10 +199,9 @@ int btrfs_check_acl(struct inode *inode, int mask, unsigned int flags)
 {
        int error = -EAGAIN;
 
-       if (flags & IPERM_FLAG_RCU) {
+       if (mask & MAY_NOT_BLOCK) {
                if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
                        error = -ECHILD;
-
        } else {
                struct posix_acl *acl;
                acl = btrfs_get_acl(inode, ACL_TYPE_ACCESS);
index abea5a17c76444edced01a069ccd2ddfc57acc6f..6b9442d1be5295c593f8f36023879ef33882cd00 100644 (file)
@@ -236,7 +236,7 @@ ext2_check_acl(struct inode *inode, int mask, unsigned int flags)
 {
        struct posix_acl *acl;
 
-       if (flags & IPERM_FLAG_RCU) {
+       if (mask & MAY_NOT_BLOCK) {
                if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
                        return -ECHILD;
                return -EAGAIN;
index 9d021c0d472a3666bc8bf77122a5ed09f877060d..0a6940d6c30cfaf4603ddceab880de965e43cd84 100644 (file)
@@ -244,7 +244,7 @@ ext3_check_acl(struct inode *inode, int mask, unsigned int flags)
 {
        struct posix_acl *acl;
 
-       if (flags & IPERM_FLAG_RCU) {
+       if (mask & MAY_NOT_BLOCK) {
                if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
                        return -ECHILD;
                return -EAGAIN;
index 21eacd7b7d79f558695b37216f6e9ea4745fb05e..4f54252e439ed409635048cf3dee77801b3098f7 100644 (file)
@@ -242,7 +242,7 @@ ext4_check_acl(struct inode *inode, int mask, unsigned int flags)
 {
        struct posix_acl *acl;
 
-       if (flags & IPERM_FLAG_RCU) {
+       if (mask & MAY_NOT_BLOCK) {
                if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
                        return -ECHILD;
                return -EAGAIN;
index 8f26d1a5891226acc324798ed84bdeb27950145c..5976bb1fa4cac93d86ad2a866733ab6c435ddfe4 100644 (file)
@@ -192,7 +192,7 @@ generic_acl_chmod(struct inode *inode)
 int
 generic_check_acl(struct inode *inode, int mask, unsigned int flags)
 {
-       if (flags & IPERM_FLAG_RCU) {
+       if (mask & MAY_NOT_BLOCK) {
                if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
                        return -ECHILD;
        } else {
index cbc07155b1a0a0e4a3d10fb47f00c7ed1cdfef8f..4d97352d39a105d524455cdd1c69ce17405c27d6 100644 (file)
@@ -80,7 +80,7 @@ int gfs2_check_acl(struct inode *inode, int mask, unsigned int flags)
        struct posix_acl *acl;
        int error;
 
-       if (flags & IPERM_FLAG_RCU) {
+       if (mask & MAY_NOT_BLOCK) {
                if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
                        return -ECHILD;
                return -EAGAIN;
index 828a0e1ea4387c19c91218b1e8d219a3d3b643b1..952afb59e6f16065849d4486d08cc62a98a7e1db 100644 (file)
@@ -264,7 +264,7 @@ int jffs2_check_acl(struct inode *inode, int mask, unsigned int flags)
        struct posix_acl *acl;
        int rc;
 
-       if (flags & IPERM_FLAG_RCU)
+       if (mask & MAY_NOT_BLOCK)
                return -ECHILD;
 
        acl = jffs2_get_acl(inode, ACL_TYPE_ACCESS);
index e5de9422fa325538e5aa3f1ca9e830e9f2b5652e..859ae5a92166a24cb35af408bd97a0742b0ebbda 100644 (file)
@@ -118,7 +118,7 @@ int jfs_check_acl(struct inode *inode, int mask, unsigned int flags)
 {
        struct posix_acl *acl;
 
-       if (flags & IPERM_FLAG_RCU)
+       if (mask & MAY_NOT_BLOCK)
                return -ECHILD;
 
        acl = jfs_get_acl(inode, ACL_TYPE_ACCESS);
index 723a3fe4bc40fb4e7f2fb66367aca1de18506815..e0624e2f0bba6f9efe150c43776b636519d845f9 100644 (file)
@@ -181,7 +181,7 @@ static int acl_permission_check(struct inode *inode, int mask, unsigned int flag
        int (*check_acl)(struct inode *inode, int mask, unsigned int flags);
        unsigned int mode = inode->i_mode;
 
-       mask &= MAY_READ | MAY_WRITE | MAY_EXEC;
+       mask &= MAY_READ | MAY_WRITE | MAY_EXEC | MAY_NOT_BLOCK;
 
        if (current_user_ns() != inode_userns(inode))
                goto other_perms;
@@ -204,7 +204,7 @@ other_perms:
        /*
         * If the DACs are ok we don't need any capability check.
         */
-       if ((mask & ~mode) == 0)
+       if ((mask & ~mode & (MAY_READ | MAY_WRITE | MAY_EXEC)) == 0)
                return 0;
        return -EACCES;
 }
index e913ad130fdd2cf9eafa0e73e343bad5974583e9..4b683ccc45063a4cfe595fe496fa080d40622302 100644 (file)
@@ -297,7 +297,7 @@ int ocfs2_check_acl(struct inode *inode, int mask, unsigned int flags)
        struct posix_acl *acl;
        int ret = -EAGAIN;
 
-       if (flags & IPERM_FLAG_RCU)
+       if (mask & MAY_NOT_BLOCK)
                return -ECHILD;
 
        osb = OCFS2_SB(inode->i_sb);
index ddc5301d2986eb09d1eb0ab201f34552ff2cb20e..6747470ec10396f38e9a5188ba92be426ace5158 100644 (file)
@@ -879,7 +879,7 @@ int reiserfs_check_acl(struct inode *inode, int mask, unsigned int flags)
        if (get_inode_sd_version(inode) == STAT_DATA_V1)
                return -EAGAIN;
 
-       if (flags & IPERM_FLAG_RCU)
+       if (mask & MAY_NOT_BLOCK)
                return -ECHILD;
 
        acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS);
index 39f4f809bb6807fa6f19b3b3e9f94b0189db60d0..278e6736135acafddd5305cfd05b77c755fb2de8 100644 (file)
@@ -235,7 +235,7 @@ xfs_check_acl(struct inode *inode, int mask, unsigned int flags)
        if (!XFS_IFORK_Q(ip))
                return -EAGAIN;
 
-       if (flags & IPERM_FLAG_RCU) {
+       if (mask & MAY_NOT_BLOCK) {
                if (!negative_cached_acl(inode, ACL_TYPE_ACCESS))
                        return -ECHILD;
                return -EAGAIN;