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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 1C0D6C433EF for ; Tue, 14 Dec 2021 07:07:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=deqrxKzZwF/RiiV5ddEa8x1K9RDaFczGXIhoOaGAd74=; b=Jp29shMnc2HUsF JwWaI0KEDqpzIoiXxGKhN6U6XctVuGBYz6e0+w1hPKcWISq9idlo1KiIUKHCMBgnF18BsfbpaMD7w cSXFHSilRQ504ZflZ/1Qq4rfGh8VDz5paYb50nOOixUf/DYLrfYz46+MZPqy1hOTowg10WhMQXDZi wXBaOmMefO0oovOrQxvTzhk8bP2Mt1Jb0FnfHKQn+PSpESt0d8YQ7ktWzMeh4K3JZc9vquA6u4UtG 6XQGa9uuFwNCSxo2E87xJmSpMmhiWznhNik2b+/1DXrq2HOfRNQ8K/Fq51qqMhWM8NCH+fQhU+nFX XahoXopcwRZyIykaVzwA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mx1sp-00CmtB-Oz; Tue, 14 Dec 2021 07:05:55 +0000 Received: from mail-pf1-x436.google.com ([2607:f8b0:4864:20::436]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mx1sl-00CmrY-Lt for linux-arm-kernel@lists.infradead.org; Tue, 14 Dec 2021 07:05:53 +0000 Received: by mail-pf1-x436.google.com with SMTP id i12so17067444pfd.6 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=qB5dX0wFY9Cgy+lxluWo4ttkYPZXRjyZMpfYD5AqNTCZUH9HI6fzdQ3eV56jDnH0RL 4kezx1HKj26d3Bp6UVHbBjQQz8H14bUbOk0og6Rw0jQ6giSp6FVjeIh6YAiQ9jQhidIg cIL86JbyXNBWOMLfNIgN5l4PJFcFbb34vYdrxMRV8sU4w4+g3Z4azD+fvViP8sBzRc0e 2IxBXVq8XbXhF8Ygg0+trL2MurDbZMVenfv7k09uus/u+CPSZYzNA+nZKQrjp777GMMS Wig+8loxpxh8lCraDATAaQfnMwFAf7WKOZxs6P1hqEtaPWB1IoAgds1FV5Etmp7AvSuk 14GA== X-Gm-Message-State: AOAM530NJV09S9pAsIPYugu/WZIEYylrjfpzloWwwX6sAwRHtBDXmOXp Tb8j2IgdTCeFrTF782KBPaMucA== 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-Disposition: inline In-Reply-To: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211213_230551_749846_F67A1C2C X-CRM114-Status: GOOD ( 18.26 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.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 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel