summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Lutomirski <luto@amacapital.net>2013-04-14 16:28:19 -0700
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-04-25 12:51:23 -0700
commitbe4c1b46075d42cbd82bc0d1e833dc4de052ae85 (patch)
tree63548c73369ca3ee7bd480446ddb2070a60f4b11
parentd2b12161ea5208d87dae24bcc5f3fed9da79262e (diff)
userns: Check uid_map's opener's fsuid, not the current fsuid
commit e3211c120a85b792978bcb4be7b2886df18d27f0 upstream. Signed-off-by: Andy Lutomirski <luto@amacapital.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r--kernel/user_namespace.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c
index 6cc21a5114d1..fdf40d6cf8a4 100644
--- a/kernel/user_namespace.c
+++ b/kernel/user_namespace.c
@@ -763,12 +763,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;
}
}