fuse: Use in_group_or_capable() helper
authorYouling Tang <tangyouling@kylinos.cn>
Thu, 20 Jun 2024 03:23:35 +0000 (11:23 +0800)
committerChristian Brauner <brauner@kernel.org>
Tue, 25 Jun 2024 09:15:48 +0000 (11:15 +0200)
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>
fs/fuse/acl.c

index 3d192b80a561965e5f902f95e3dcf974308d1b36..04cfd8fee992e4c7117ac4f2cdf00acc117f51a9 100644 (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);