Commit e933c15f authored by Christian Brauner's avatar Christian Brauner Committed by Christian Brauner (Microsoft)

acl: port to vfs{g,u}id_t

Port the few remaining pieces to vfs{g,u}id_t and associated type safe helpers.
Signed-off-by: default avatarChristian Brauner (Microsoft) <brauner@kernel.org>
parent 0c5fd887
...@@ -361,8 +361,8 @@ posix_acl_permission(struct user_namespace *mnt_userns, struct inode *inode, ...@@ -361,8 +361,8 @@ posix_acl_permission(struct user_namespace *mnt_userns, struct inode *inode,
{ {
const struct posix_acl_entry *pa, *pe, *mask_obj; const struct posix_acl_entry *pa, *pe, *mask_obj;
int found = 0; int found = 0;
kuid_t uid; vfsuid_t vfsuid;
kgid_t gid; vfsgid_t vfsgid;
want &= MAY_READ | MAY_WRITE | MAY_EXEC; want &= MAY_READ | MAY_WRITE | MAY_EXEC;
...@@ -370,28 +370,28 @@ posix_acl_permission(struct user_namespace *mnt_userns, struct inode *inode, ...@@ -370,28 +370,28 @@ posix_acl_permission(struct user_namespace *mnt_userns, struct inode *inode,
switch(pa->e_tag) { switch(pa->e_tag) {
case ACL_USER_OBJ: case ACL_USER_OBJ:
/* (May have been checked already) */ /* (May have been checked already) */
uid = i_uid_into_mnt(mnt_userns, inode); vfsuid = i_uid_into_vfsuid(mnt_userns, inode);
if (uid_eq(uid, current_fsuid())) if (vfsuid_eq_kuid(vfsuid, current_fsuid()))
goto check_perm; goto check_perm;
break; break;
case ACL_USER: case ACL_USER:
uid = mapped_kuid_fs(mnt_userns, &init_user_ns, vfsuid = make_vfsuid(mnt_userns, &init_user_ns,
pa->e_uid); pa->e_uid);
if (uid_eq(uid, current_fsuid())) if (vfsuid_eq_kuid(vfsuid, current_fsuid()))
goto mask; goto mask;
break; break;
case ACL_GROUP_OBJ: case ACL_GROUP_OBJ:
gid = i_gid_into_mnt(mnt_userns, inode); vfsgid = i_gid_into_vfsgid(mnt_userns, inode);
if (in_group_p(gid)) { if (vfsgid_in_group_p(vfsgid)) {
found = 1; found = 1;
if ((pa->e_perm & want) == want) if ((pa->e_perm & want) == want)
goto mask; goto mask;
} }
break; break;
case ACL_GROUP: case ACL_GROUP:
gid = mapped_kgid_fs(mnt_userns, &init_user_ns, vfsgid = make_vfsgid(mnt_userns, &init_user_ns,
pa->e_gid); pa->e_gid);
if (in_group_p(gid)) { if (vfsgid_in_group_p(vfsgid)) {
found = 1; found = 1;
if ((pa->e_perm & want) == want) if ((pa->e_perm & want) == want)
goto mask; goto mask;
...@@ -697,7 +697,7 @@ int posix_acl_update_mode(struct user_namespace *mnt_userns, ...@@ -697,7 +697,7 @@ int posix_acl_update_mode(struct user_namespace *mnt_userns,
return error; return error;
if (error == 0) if (error == 0)
*acl = NULL; *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)) !capable_wrt_inode_uidgid(mnt_userns, inode, CAP_FSETID))
mode &= ~S_ISGID; mode &= ~S_ISGID;
*mode_p = mode; *mode_p = mode;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment