fuse: Use in_group_or_capable() helper

Use the in_group_or_capable() helper function to simplify the code.

Signed-off-by: Youling Tang <tangyouling@kylinos.cn>
Link: https://lore.kernel.org/r/20240620032335.147136-3-youling.tang@linux.dev
Signed-off-by: Christian Brauner <brauner@kernel.org>
This commit is contained in:
Youling Tang 2024-06-20 11:23:35 +08:00 committed by Christian Brauner
parent 8444ee22ad
commit 153216cf7b
No known key found for this signature in database
GPG key ID: 91C61BC06578DCA2

View file

@ -146,8 +146,8 @@ int fuse_set_acl(struct mnt_idmap *idmap, struct dentry *dentry,
* be stripped.
*/
if (fc->posix_acl &&
!vfsgid_in_group_p(i_gid_into_vfsgid(&nop_mnt_idmap, inode)) &&
!capable_wrt_inode_uidgid(&nop_mnt_idmap, inode, CAP_FSETID))
!in_group_or_capable(&nop_mnt_idmap, inode,
i_gid_into_vfsgid(&nop_mnt_idmap, inode)))
extra_flags |= FUSE_SETXATTR_ACL_KILL_SGID;
ret = fuse_setxattr(inode, name, value, size, 0, extra_flags);