]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - fs/btrfs/acl.c
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mason/btrfs...
[net-next-2.6.git] / fs / btrfs / acl.c
index 8d432cd9d580d39ed2e94bf3be99c17667a8b0dd..2222d161c7b68111431031e007b019d7de629d3e 100644 (file)
@@ -60,6 +60,8 @@ static struct posix_acl *btrfs_get_acl(struct inode *inode, int type)
                size = __btrfs_getxattr(inode, name, value, size);
                if (size > 0) {
                        acl = posix_acl_from_xattr(value, size);
+                       if (IS_ERR(acl))
+                               return acl;
                        set_cached_acl(inode, type, acl);
                }
                kfree(value);
@@ -160,6 +162,12 @@ 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))
+               return -EPERM;
+
+       if (!IS_POSIXACL(dentry->d_inode))
+               return -EOPNOTSUPP;
+
        if (value) {
                acl = posix_acl_from_xattr(value, size);
                if (acl == NULL) {