Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756113AbbGEJHf (ORCPT ); Sun, 5 Jul 2015 05:07:35 -0400 Received: from mail-la0-f43.google.com ([209.85.215.43]:34203 "EHLO mail-la0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755213AbbGEJH2 (ORCPT ); Sun, 5 Jul 2015 05:07:28 -0400 MIME-Version: 1.0 In-Reply-To: <20150703214446.GZ17917@localhost.localdomain> References: <1435825714-3567-1-git-send-email-dh.herrmann@gmail.com> <1435825714-3567-6-git-send-email-dh.herrmann@gmail.com> <20150703214446.GZ17917@localhost.localdomain> Date: Sat, 4 Jul 2015 13:26:10 +0200 Message-ID: Subject: Re: [PATCH 5/6] kdbus: pin namespaces on HELLO From: David Herrmann To: Sergei Zviagintsev Cc: linux-kernel , Greg Kroah-Hartman , Daniel Mack , Djalal Harouni Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1931 Lines: 38 Hi On Fri, Jul 3, 2015 at 11:44 PM, Sergei Zviagintsev wrote: > On Thu, Jul 02, 2015 at 10:28:33AM +0200, David Herrmann wrote: >> /* >> - * This translates the effective capabilities of 'cred' into the current >> - * user-namespace. If the current user-namespace is a child-namespace of >> + * This translates the effective capabilities of 'cred' into the given >> + * user-namespace. If the given user-namespace is a child-namespace of >> * the user-namespace of 'cred', the mask can be copied verbatim. If >> * not, the mask is cleared. >> * There's one exception: If 'cred' is the owner of any user-namespace >> - * in the path between the current user-namespace and the user-namespace >> + * in the path between the given user-namespace and the user-namespace >> * of 'cred', then it has all effective capabilities set. This means, >> * the user who created a user-namespace always has all effective >> * capabilities in any child namespaces. Note that this is based on the >> * uid of the namespace creator, not the task hierarchy. >> */ >> - for (iter = current_user_ns(); iter; iter = iter->parent) { >> + for (iter = user_ns; iter; iter = iter->parent) { > > Is check `iter' for being not NULL is needed here? I mean, `iter' takes > range from `user_ns' (which is cred->user_ns) to &init_user_ns. This patch does not change the logic of this lookup, but only the source of the user-namespace. Hence, a change of this loop-head would be inappropriate. Nevertheless, I prefer being rather safe than sorry here, so I don't mind the current code. Thanks David -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/