From: Andy Lutomirski Date: Sun, 14 Apr 2013 23:28:19 +0000 (-0700) Subject: userns: Check uid_map's opener's fsuid, not the current fsuid X-Git-Tag: submit/tizen/20141203.153721~2474^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e3211c120a85b792978bcb4be7b2886df18d27f0;p=platform%2Fkernel%2Flinux-arm64.git userns: Check uid_map's opener's fsuid, not the current fsuid Signed-off-by: Andy Lutomirski --- diff --git a/kernel/user_namespace.c b/kernel/user_namespace.c index e2d4ace4481..5c16f3aa757 100644 --- a/kernel/user_namespace.c +++ b/kernel/user_namespace.c @@ -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; } }