* [PATCH] btrfs: should add a permission check for setfacl
@ 2010-05-18 0:50 Shi Weihua
2010-05-20 8:33 ` Christoph Hellwig
0 siblings, 1 reply; 2+ messages in thread
From: Shi Weihua @ 2010-05-18 0:50 UTC (permalink / raw)
To: chris.mason, Yan, Zheng; +Cc: linux-btrfs, LKML
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>
---
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c
index da3133c..12d7be8 100644
--- a/fs/btrfs/acl.c
+++ b/fs/btrfs/acl.c
@@ -159,6 +159,9 @@ static int btrfs_xattr_set_acl(struct inode *inode, int type,
int ret;
struct posix_acl *acl = NULL;
+ if (!is_owner_or_cap(inode))
+ return -EPERM;
+
if (value) {
acl = posix_acl_from_xattr(value, size);
if (acl == NULL) {
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] btrfs: should add a permission check for setfacl
2010-05-18 0:50 [PATCH] btrfs: should add a permission check for setfacl Shi Weihua
@ 2010-05-20 8:33 ` Christoph Hellwig
0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2010-05-20 8:33 UTC (permalink / raw)
To: Shi Weihua; +Cc: chris.mason, Yan, Zheng, linux-btrfs, LKML
On Tue, May 18, 2010 at 08:50:32AM +0800, Shi Weihua wrote:
> 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
Can you add this as a new testcase to xfstests so that we can easiy
check for regressions and future filesystems implementing this
correctly?
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-05-20 8:33 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-18 0:50 [PATCH] btrfs: should add a permission check for setfacl Shi Weihua
2010-05-20 8:33 ` Christoph Hellwig
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).