acl: port to vfs{g,u}id_t
authorChristian Brauner <brauner@kernel.org>
Sat, 9 Jul 2022 10:23:20 +0000 (12:23 +0200)
committerChristian Brauner (Microsoft) <brauner@kernel.org>
Fri, 15 Jul 2022 20:09:56 +0000 (22:09 +0200)
Port the few remaining pieces to vfs{g,u}id_t and associated type safe helpers.

Signed-off-by: Christian Brauner (Microsoft) <brauner@kernel.org>
fs/posix_acl.c

index d954852a0158a89bbe00747b7504405c02942842..d4b60c18fda769b904507f54f10768abe76b5b2d 100644 (file)
@@ -361,8 +361,8 @@ posix_acl_permission(struct user_namespace *mnt_userns, struct inode *inode,
 {
        const struct posix_acl_entry *pa, *pe, *mask_obj;
        int found = 0;
-       kuid_t uid;
-       kgid_t gid;
+       vfsuid_t vfsuid;
+       vfsgid_t vfsgid;
 
        want &= MAY_READ | MAY_WRITE | MAY_EXEC;
 
@@ -370,28 +370,28 @@ posix_acl_permission(struct user_namespace *mnt_userns, struct inode *inode,
                 switch(pa->e_tag) {
                         case ACL_USER_OBJ:
                                /* (May have been checked already) */
-                               uid = i_uid_into_mnt(mnt_userns, inode);
-                               if (uid_eq(uid, current_fsuid()))
+                               vfsuid = i_uid_into_vfsuid(mnt_userns, inode);
+                               if (vfsuid_eq_kuid(vfsuid, current_fsuid()))
                                         goto check_perm;
                                 break;
                         case ACL_USER:
-                               uid = mapped_kuid_fs(mnt_userns, &init_user_ns,
+                               vfsuid = make_vfsuid(mnt_userns, &init_user_ns,
                                                     pa->e_uid);
-                               if (uid_eq(uid, current_fsuid()))
+                               if (vfsuid_eq_kuid(vfsuid, current_fsuid()))
                                         goto mask;
                                break;
                         case ACL_GROUP_OBJ:
-                               gid = i_gid_into_mnt(mnt_userns, inode);
-                               if (in_group_p(gid)) {
+                               vfsgid = i_gid_into_vfsgid(mnt_userns, inode);
+                               if (vfsgid_in_group_p(vfsgid)) {
                                        found = 1;
                                        if ((pa->e_perm & want) == want)
                                                goto mask;
                                 }
                                break;
                         case ACL_GROUP:
-                               gid = mapped_kgid_fs(mnt_userns, &init_user_ns,
+                               vfsgid = make_vfsgid(mnt_userns, &init_user_ns,
                                                     pa->e_gid);
-                               if (in_group_p(gid)) {
+                               if (vfsgid_in_group_p(vfsgid)) {
                                        found = 1;
                                        if ((pa->e_perm & want) == want)
                                                goto mask;
@@ -697,7 +697,7 @@ int posix_acl_update_mode(struct user_namespace *mnt_userns,
                return error;
        if (error == 0)
                *acl = NULL;
-       if (!in_group_p(i_gid_into_mnt(mnt_userns, inode)) &&
+       if (!vfsgid_in_group_p(i_gid_into_vfsgid(mnt_userns, inode)) &&
            !capable_wrt_inode_uidgid(mnt_userns, inode, CAP_FSETID))
                mode &= ~S_ISGID;
        *mode_p = mode;