Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

fs: Use in_group_or_capable() helper to simplify the code

Since in_group_or_capable has been exported, we can use
it to simplify the code when check group and capable.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
Link: https://lore.kernel.org/r/20240816063849.1989856-1-lihongbo22@huawei.com
Reviewed-by: Jan Kara <jack@suse.cz>
Signed-off-by: Christian Brauner <brauner@kernel.org>

authored by

Hongbo Li and committed by
Christian Brauner
1aeb6def b381fbbc

+2 -2
+2 -2
fs/posix_acl.c
··· 715 715 return error; 716 716 if (error == 0) 717 717 *acl = NULL; 718 - if (!vfsgid_in_group_p(i_gid_into_vfsgid(idmap, inode)) && 719 - !capable_wrt_inode_uidgid(idmap, inode, CAP_FSETID)) 718 + if (!in_group_or_capable(idmap, inode, 719 + i_gid_into_vfsgid(idmap, inode))) 720 720 mode &= ~S_ISGID; 721 721 *mode_p = mode; 722 722 return 0;