From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DE267C433EF for ; Tue, 14 Dec 2021 07:05:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231283AbhLNHFr (ORCPT ); Tue, 14 Dec 2021 02:05:47 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43470 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231260AbhLNHFq (ORCPT ); Tue, 14 Dec 2021 02:05:46 -0500 Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 93E16C06173F for ; Mon, 13 Dec 2021 23:05:46 -0800 (PST) Received: by mail-pf1-x430.google.com with SMTP id 8so17072610pfo.4 for ; Mon, 13 Dec 2021 23:05:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=u9uJx6Yzs8VAbaAVVWgb3c7raYuZyWdXpq+qPzpYeZM=; b=Y902Ahq4o+Npt/dUrRkpBbcRT1bmljFp51/i3oPcGlXJnJK0PhKJX5yQ3f1r9oaTY3 63IgklBVpGUo8EV/WJeEfGD8UDZI17HHrx6WTahkqndWYAD+tl/V+PXNJ+9rZjMopQhw mqSCgdxe/1fFY1aX0trqSTX62HRVMPvQ3qmJaoZevziFRcZj7igLkY/AQ4twp2YUhI5y y2AWFMxffDJZx9Ewy7w9BKfWe+/MZJt6uNuTPE1YQOd0xBtAOd1f6C3bb6z65vyfpfpX hCQdjonogxPVWUY+5WAPOpSqxw3D6BPAgNoTUmmIc2KXwWSlwjykpoEgntMBrQD5QRWC BWUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=u9uJx6Yzs8VAbaAVVWgb3c7raYuZyWdXpq+qPzpYeZM=; b=wTvj6EdtbrFTgqIBQVy6qQCiQ+97Lb61dGtSpQvGal5CUmwpJLTZfxVmJ4Aru4XZZU P5s6U2SOEJqBOPI325Wnh+VqIGbo8ZHeRg2xueaaX+ElKsqHPnTC58emr8iUM5JMR9Wg 3eHAaeKnUgIb7zI8v4BWoCmGK88jbkEaZJYfRUQBy03xEfxMJ8z1skIJEJEEikB5zty6 OvbrLLBVzzNjuf1sW5VujsEm7zIArL7QiVXAzIc6FbOi+jP4JDWrrKQQNDKvwbJ19ZFG GBYtPMZsiVA9Zv3Mud6+kajPD2yKBZd7P9Yaaxyfg1eyG+41WFTtabV0slbHYEPdlscO ECqA== X-Gm-Message-State: AOAM533pcrikMwTeS6f+IbW/fA3lrS6HEjuLt2Rzh/PH3g6DGfyWfL31 Qw+eN4juzZzaEeD9xO9aiA/uXg== X-Google-Smtp-Source: ABdhPJz65bi9c7M0fZgffgbxVusSpsiNlfIGYC1wjPy5i0UuQiVHxioVmPTqUEQV+R+LXxo5SjqWTw== X-Received: by 2002:a05:6a00:22c3:b0:4b6:197:ae5a with SMTP id f3-20020a056a0022c300b004b60197ae5amr1474920pfj.42.1639465545684; Mon, 13 Dec 2021 23:05:45 -0800 (PST) Received: from leoy-ThinkPad-X240s ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id fw21sm1238200pjb.25.2021.12.13.23.05.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Dec 2021 23:05:45 -0800 (PST) Date: Tue, 14 Dec 2021 15:05:34 +0800 From: Leo Yan To: Balbir Singh Cc: "David S. Miller" , Jakub Kicinski , Leon Romanovsky , Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jan Harkes , coda@cs.cmu.edu, Paul Moore , Eric Paris , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, codalist@coda.cs.cmu.edu, linux-audit@redhat.com Subject: Re: [PATCH v2 4/7] connector/cn_proc: Use task_is_in_init_pid_ns() Message-ID: <20211214070534.GA1721898@leoy-ThinkPad-X240s> References: <20211208083320.472503-1-leo.yan@linaro.org> <20211208083320.472503-5-leo.yan@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Dec 14, 2021 at 04:58:32PM +1100, Balbir Singh wrote: > On Wed, Dec 08, 2021 at 04:33:17PM +0800, Leo Yan wrote: > > This patch replaces open code with task_is_in_init_pid_ns() to check if > > a task is in root PID namespace. > > > > Signed-off-by: Leo Yan > > --- > > drivers/connector/cn_proc.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/connector/cn_proc.c b/drivers/connector/cn_proc.c > > index 646ad385e490..ccac1c453080 100644 > > --- a/drivers/connector/cn_proc.c > > +++ b/drivers/connector/cn_proc.c > > @@ -358,7 +358,7 @@ static void cn_proc_mcast_ctl(struct cn_msg *msg, > > * other namespaces. > > */ > > if ((current_user_ns() != &init_user_ns) || > > - (task_active_pid_ns(current) != &init_pid_ns)) > > + !task_is_in_init_pid_ns(current)) > > return; > > > > Sounds like there might scope for other wrappers - is_current_in_user_init_ns() Indeed, for new wrapper is_current_in_user_init_ns(), I searched kernel and located there have multiple places use open code. If no one works on this refactoring, I will send a new patchset for it separately. > Acked-by: Balbir Singh Thank you for review, Balbir! Also thanks review from Leon and Suzuki. Leo