[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20160831025605.GA21788@mail.hallyn.com>
Date: Tue, 30 Aug 2016 21:56:05 -0500
From: "Serge E. Hallyn" <serge@...lyn.com>
To: Andrei Vagin <avagin@...nvz.org>
Cc: "Eric W. Biederman" <ebiederm@...ssion.com>,
containers@...ts.linux-foundation.org,
Serge Hallyn <serge.hallyn@...onical.com>,
linux-api@...r.kernel.org, linux-kernel@...r.kernel.org,
James Bottomley <James.Bottomley@...senPartnership.com>,
"Michael Kerrisk (man-pages)" <mtk.manpages@...il.com>,
linux-fsdevel@...r.kernel.org,
Alexander Viro <viro@...iv.linux.org.uk>
Subject: Re: [PATCH 1/4] kernel: add a helper to get an owning user namespace
for a namespace
On Fri, Aug 26, 2016 at 04:08:08PM -0700, Andrei Vagin wrote:
> +struct ns_common *ns_get_owner(struct ns_common *ns)
> +{
> + struct user_namespace *my_user_ns = current_user_ns();
> + struct user_namespace *owner, *p;
> +
> + /* See if the owner is in the current user namespace */
> + owner = p = ns->ops->get_owner(ns);
> + for (;;) {
> + if (!p)
> + return ERR_PTR(-EPERM);
> + if (p == my_user_ns)
> + break;
> + p = p->parent;
> + }
> +
> + return &get_user_ns(owner)->ns;
get_user_ns() bumps the owner's refcount. I don't see where
this is being dropped, especially when ns_ioctl() uses it in
the next patch.
Powered by blists - more mailing lists