Skip to content

Commit

Permalink
userns: Check uid_map's opener's fsuid, not the current fsuid
Browse files Browse the repository at this point in the history
Signed-off-by: Andy Lutomirski <luto@amacapital.net>
  • Loading branch information
amluto committed Apr 15, 2013
1 parent 6708075 commit e3211c1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions kernel/user_namespace.c
Original file line number Diff line number Diff line change
Expand Up @@ -797,12 +797,12 @@ static bool new_idmap_permitted(const struct file *file,
u32 id = new_map->extent[0].lower_first;
if (cap_setid == CAP_SETUID) {
kuid_t uid = make_kuid(ns->parent, id);
if (uid_eq(uid, current_fsuid()))
if (uid_eq(uid, file->f_cred->fsuid))
return true;
}
else if (cap_setid == CAP_SETGID) {
kgid_t gid = make_kgid(ns->parent, id);
if (gid_eq(gid, current_fsgid()))
if (gid_eq(gid, file->f_cred->fsgid))
return true;
}
}
Expand Down

0 comments on commit e3211c1

Please sign in to comment.