]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
fs: Use in_group_or_capable() helper to simplify the code
authorHongbo Li <lihongbo22@huawei.com>
Fri, 16 Aug 2024 06:38:49 +0000 (14:38 +0800)
committerChristian Brauner <brauner@kernel.org>
Fri, 30 Aug 2024 06:22:37 +0000 (08:22 +0200)
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>
fs/posix_acl.c

index 3f87297dbfdb70ea00c1bac533eacada58535be0..6c66a37522d00161c1a8a4a476b1b1d9449fdf16 100644 (file)
@@ -715,8 +715,8 @@ int posix_acl_update_mode(struct mnt_idmap *idmap,
                return error;
        if (error == 0)
                *acl = NULL;
-       if (!vfsgid_in_group_p(i_gid_into_vfsgid(idmap, inode)) &&
-           !capable_wrt_inode_uidgid(idmap, inode, CAP_FSETID))
+       if (!in_group_or_capable(idmap, inode,
+                                i_gid_into_vfsgid(idmap, inode)))
                mode &= ~S_ISGID;
        *mode_p = mode;
        return 0;