kernel: add a helper to get an owning user namespace for a namespace
authorAndrey Vagin <avagin@openvz.org>
Tue, 6 Sep 2016 07:47:13 +0000 (00:47 -0700)
committerEric W. Biederman <ebiederm@xmission.com>
Fri, 23 Sep 2016 00:59:39 +0000 (19:59 -0500)
commitbcac25a58bfc6bd79191ac5d7afb49bea96da8c9
tree28a8ae71b2939267deba0807bcbbed28e77470c0
parent29b4817d4018df78086157ea3a55c1d9424a7cfc
kernel: add a helper to get an owning user namespace for a namespace

Return -EPERM if an owning user namespace is outside of a process
current user namespace.

v2: In a first version ns_get_owner returned ENOENT for init_user_ns.
    This special cases was removed from this version. There is nothing
    outside of init_user_ns, so we can return EPERM.
v3: rename ns->get_owner() to ns->owner(). get_* usually means that it
grabs a reference.

Acked-by: Serge Hallyn <serge@hallyn.com>
Signed-off-by: Andrei Vagin <avagin@openvz.org>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
fs/namespace.c
include/linux/proc_ns.h
include/linux/user_namespace.h
ipc/namespace.c
kernel/cgroup.c
kernel/pid_namespace.c
kernel/user_namespace.c
kernel/utsname.c
net/core/net_namespace.c