Commit e3211c120a85b792978bcb4be7b2886df18d27f0

Authored by Andy Lutomirski
1 parent 6708075f10

userns: Check uid_map's opener's fsuid, not the current fsuid

Signed-off-by: Andy Lutomirski <luto@amacapital.net>

Showing 1 changed file with 2 additions and 2 deletions Side-by-side Diff

kernel/user_namespace.c
... ... @@ -797,12 +797,12 @@
797 797 u32 id = new_map->extent[0].lower_first;
798 798 if (cap_setid == CAP_SETUID) {
799 799 kuid_t uid = make_kuid(ns->parent, id);
800   - if (uid_eq(uid, current_fsuid()))
  800 + if (uid_eq(uid, file->f_cred->fsuid))
801 801 return true;
802 802 }
803 803 else if (cap_setid == CAP_SETGID) {
804 804 kgid_t gid = make_kgid(ns->parent, id);
805   - if (gid_eq(gid, current_fsgid()))
  805 + if (gid_eq(gid, file->f_cred->fsgid))
806 806 return true;
807 807 }
808 808 }