lkml.org 
[lkml]   [2010]   [Jul]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch 126/149] Btrfs: should add a permission check for setfacl
    2.6.32-stable review patch.  If anyone has any objections, please let us know.

    ------------------

    From: Shi Weihua <shiwh@cn.fujitsu.com>

    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 | 3 +++
    1 file changed, 3 insertions(+)

    --- a/fs/btrfs/acl.c
    +++ b/fs/btrfs/acl.c
    @@ -157,6 +157,9 @@ static int btrfs_xattr_set_acl(struct in
    int ret = 0;
    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) {



    \
     
     \ /
      Last update: 2010-07-01 20:47    [W:5.830 / U:0.008 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site