Btrfs: should add a permission check for setfacl
authorShi Weihua <shiwh@cn.fujitsu.com>
Tue, 18 May 2010 00:50:32 +0000 (00:50 +0000)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 5 Jul 2010 18:11:15 +0000 (11:11 -0700)
commit20dab696625a1eb15703d6d3db5bc3e7f8d9244b
tree57b3297934109b7bb1b4279779324e80fdbc7c60
parenta9689bca9259bee4a8a2fab77d551836fbc1701a
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>
fs/btrfs/acl.c