• Jan Kara's avatar
    xfs: Don't clear SGID when inheriting ACLs · 8ba35875
    Jan Kara authored
    When new directory 'DIR1' is created in a directory 'DIR0' with SGID bit
    set, DIR1 is expected to have SGID bit set (and owning group equal to
    the owning group of 'DIR0'). However when 'DIR0' also has some default
    ACLs that 'DIR1' inherits, setting these ACLs will result in SGID bit on
    'DIR1' to get cleared if user is not member of the owning group.
    
    Fix the problem by calling __xfs_set_acl() instead of xfs_set_acl() when
    setting up inode in xfs_generic_create(). That prevents SGID bit
    clearing and mode is properly set by posix_acl_create() anyway. We also
    reorder arguments of __xfs_set_acl() to match the ordering of
    xfs_set_acl() to make things consistent.
    
    Fixes: 07393101
    CC: stable@vger.kernel.org
    CC: Darrick J. Wong <darrick.wong@oracle.com>
    CC: linux-xfs@vger.kernel.org
    Signed-off-by: default avatarJan Kara <jack@suse.cz>
    Reviewed-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    Signed-off-by: default avatarDarrick J. Wong <darrick.wong@oracle.com>
    8ba35875
xfs_acl.c 5.87 KB