From mboxrd@z Thu Jan 1 00:00:00 1970 From: Djalal Harouni Subject: Re: [PATCH review 03/13] ipc: Initialize ipc_namespace->user_ns early. Date: Fri, 24 Jun 2016 16:34:14 +0200 Message-ID: References: <87fus77pns.fsf@x220.int.ebiederm.org> <20160620172130.15712-1-ebiederm@xmission.com> <20160620172130.15712-3-ebiederm@xmission.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20160620172130.15712-3-ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: containers-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: "Eric W. Biederman" Cc: Miklos Szeredi , Linux Containers , Andy Lutomirski , James Bottomley , Seth Forshee , Linux FS Devel List-Id: containers.vger.kernel.org On Mon, Jun 20, 2016 at 7:21 PM, Eric W. Biederman wrote: > Allow the ipc namespace initialization code to depend on ns->user_ns > being set during initialization. > > In particular this allows mq_init_ns to use ns->user_ns for permission > checks and initializating s_user_ns while the the mq filesystem is > being mounted. > > Acked-by: Seth Forshee > Suggested-by: Seth Forshee > Signed-off-by: "Eric W. Biederman" Reviewed-by: Djalal Harouni > --- > ipc/namespace.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/ipc/namespace.c b/ipc/namespace.c > index 068caf18d565..04cb07eb81f1 100644 > --- a/ipc/namespace.c > +++ b/ipc/namespace.c > @@ -34,8 +34,11 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns, > ns->ns.ops = &ipcns_operations; > > atomic_set(&ns->count, 1); > + ns->user_ns = get_user_ns(user_ns); > + > err = mq_init_ns(ns); > if (err) { > + put_user_ns(ns->user_ns); > ns_free_inum(&ns->ns); > kfree(ns); > return ERR_PTR(err); > @@ -46,8 +49,6 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns, > msg_init_ns(ns); > shm_init_ns(ns); > > - ns->user_ns = get_user_ns(user_ns); > - > return ns; > } > > -- > 2.8.3 > -- tixxdz http://opendz.org http://blog.opendz.org From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qk0-f194.google.com ([209.85.220.194]:34587 "EHLO mail-qk0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751603AbcFXOeQ (ORCPT ); Fri, 24 Jun 2016 10:34:16 -0400 Received: by mail-qk0-f194.google.com with SMTP id j2so21211477qkf.1 for ; Fri, 24 Jun 2016 07:34:15 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: <20160620172130.15712-3-ebiederm@xmission.com> References: <87fus77pns.fsf@x220.int.ebiederm.org> <20160620172130.15712-1-ebiederm@xmission.com> <20160620172130.15712-3-ebiederm@xmission.com> From: Djalal Harouni Date: Fri, 24 Jun 2016 16:34:14 +0200 Message-ID: Subject: Re: [PATCH review 03/13] ipc: Initialize ipc_namespace->user_ns early. To: "Eric W. Biederman" Cc: Linux Containers , Linux FS Devel , Miklos Szeredi , James Bottomley , Seth Forshee , "Serge E. Hallyn" , Andy Lutomirski Content-Type: text/plain; charset=UTF-8 Sender: linux-fsdevel-owner@vger.kernel.org List-ID: On Mon, Jun 20, 2016 at 7:21 PM, Eric W. Biederman wrote: > Allow the ipc namespace initialization code to depend on ns->user_ns > being set during initialization. > > In particular this allows mq_init_ns to use ns->user_ns for permission > checks and initializating s_user_ns while the the mq filesystem is > being mounted. > > Acked-by: Seth Forshee > Suggested-by: Seth Forshee > Signed-off-by: "Eric W. Biederman" Reviewed-by: Djalal Harouni > --- > ipc/namespace.c | 5 +++-- > 1 file changed, 3 insertions(+), 2 deletions(-) > > diff --git a/ipc/namespace.c b/ipc/namespace.c > index 068caf18d565..04cb07eb81f1 100644 > --- a/ipc/namespace.c > +++ b/ipc/namespace.c > @@ -34,8 +34,11 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns, > ns->ns.ops = &ipcns_operations; > > atomic_set(&ns->count, 1); > + ns->user_ns = get_user_ns(user_ns); > + > err = mq_init_ns(ns); > if (err) { > + put_user_ns(ns->user_ns); > ns_free_inum(&ns->ns); > kfree(ns); > return ERR_PTR(err); > @@ -46,8 +49,6 @@ static struct ipc_namespace *create_ipc_ns(struct user_namespace *user_ns, > msg_init_ns(ns); > shm_init_ns(ns); > > - ns->user_ns = get_user_ns(user_ns); > - > return ns; > } > > -- > 2.8.3 > -- tixxdz http://opendz.org http://blog.opendz.org