Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1472992
| From | "Serge E. Hallyn" <serge@hallyn.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/4] kernel: add a helper to get an owning user namespace for a namespace |
| Date | 2016-08-31 05:00 +0200 |
| Message-ID | <sc3UR-52f-3@gated-at.bofh.it> (permalink) |
| References | <sayq5-56V-15@gated-at.bofh.it> <sayq5-56V-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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.
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/4 v2] Add an interface to discover relationships between namespaces Andrei Vagin <avagin@openvz.org> - 2016-08-27 01:10 +0200
[PATCH 2/4] nsfs: add ioctl to get an owning user namespace for ns file descriptor Andrei Vagin <avagin@openvz.org> - 2016-08-27 01:10 +0200
[PATCH 4/4] tools/testing: add a test to check nsfs ioctl-s Andrei Vagin <avagin@openvz.org> - 2016-08-27 01:10 +0200
[PATCH 3/4] nsfs: add ioctl to get a parent namespace Andrei Vagin <avagin@openvz.org> - 2016-08-27 01:10 +0200
[PATCH 1/4] kernel: add a helper to get an owning user namespace for a namespace Andrei Vagin <avagin@openvz.org> - 2016-08-27 01:10 +0200
Re: [PATCH 1/4] kernel: add a helper to get an owning user namespace for a namespace "Serge E. Hallyn" <serge@hallyn.com> - 2016-08-31 04:50 +0200
Re: [PATCH 1/4] kernel: add a helper to get an owning user namespace for a namespace Andrey Vagin <avagin@openvz.org> - 2016-08-31 23:20 +0200
Re: [PATCH 1/4] kernel: add a helper to get an owning user namespace for a namespace "Serge E. Hallyn" <serge@hallyn.com> - 2016-09-01 00:00 +0200
Re: [PATCH 1/4] kernel: add a helper to get an owning user namespace for a namespace "Serge E. Hallyn" <serge@hallyn.com> - 2016-08-31 05:00 +0200
Re: [PATCH 1/4] kernel: add a helper to get an owning user namespace for a namespace Andrey Vagin <avagin@openvz.org> - 2016-08-31 22:40 +0200
Re: [PATCH 1/4] kernel: add a helper to get an owning user namespace for a namespace "Serge E. Hallyn" <serge@hallyn.com> - 2016-09-01 07:20 +0200
csiph-web