diff options
author | Shi Weihua <shiwh@cn.fujitsu.com> | 2010-05-18 00:50:32 +0000 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2010-07-05 11:16:09 -0700 |
commit | 62008a6b67c40a295086607e34ba5816d6642f88 (patch) | |
tree | 7ab8d2e7d14a18638b918525eeda50540519510e /fs | |
parent | 8ec8b5bf52a674755f688142d7ac6fd0bc82fe66 (diff) | |
download | lwn-62008a6b67c40a295086607e34ba5816d6642f88.tar.gz lwn-62008a6b67c40a295086607e34ba5816d6642f88.zip |
Btrfs: should add a permission check for setfacl
commit 2f26afba46f0ebf155cf9be746496a0304a5b7cf upstream.
On btrfs, do the following
------------------
# su user1
# cd btrfs-part/
# touch aaa
# getfacl aaa
# file: aaa
# owner: user1
# group: user1
user::rw-
group::rw-
other::r--
# su user2
# cd btrfs-part/
# setfacl -m u::rwx aaa
# getfacl aaa
# file: aaa
# owner: user1
# group: user1
user::rwx <- successed to setfacl
group::rw-
other::r--
------------------
but we should prohibit it that user2 changing user1's acl.
In fact, on ext3 and other fs, a message occurs:
setfacl: aaa: Operation not permitted
This patch fixed it.
Signed-off-by: Shi Weihua <shiwh@cn.fujitsu.com>
Signed-off-by: Chris Mason <chris.mason@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/btrfs/acl.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index 6df6d6ed74fd..9be949a231e1 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c @@ -159,6 +159,9 @@ 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 (value) { acl = posix_acl_from_xattr(value, size); if (acl == NULL) { |