From patchwork Wed Dec 8 08:33:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12695299 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 6A5DDC433F5 for ; Wed, 8 Dec 2021 08:35:52 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SiAWgojgDlo2ALStpmZLs9VFC1F8jzZbg2dbC+hJeAg=; b=Pi/n01SZfsy3uY XBnSGlRn0JWPK198uOjZuqOywEdASTz+B5DGlYqdaMD3E7qMpSn1syqgFho1eWNiIwMCNb7uBE/gG ur4FUnUayfwVl8w0JhqEO87hiM/C74Rg6ZHvBJsIYkrdmZIccOTOm3O23bY8Lr6FyeUurfDhG3bL8 /78R19cpBqAUjRljWeaZOiALWGIDspvirqkvVeqCy2PyGWh9P5p6B6Y5ExSMHJKXM3mhOSiXG3smE N6yleoBm3Eg5VmbbpVYB6YU5xNci4/FOYpP8fYqwt/SQxGT1cXRXZXo6jpSgtgvCE5+BqNsdAJ498 jOY+cP5iXIwCOz/20bIA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1musP0-00BiEJ-EW; Wed, 08 Dec 2021 08:34:14 +0000 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1musOP-00Bi1C-L9 for linux-arm-kernel@lists.infradead.org; Wed, 08 Dec 2021 08:33:39 +0000 Received: by mail-ed1-x52d.google.com with SMTP id z5so5822157edd.3 for ; Wed, 08 Dec 2021 00:33:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=hWyoQ03AyiBHBWIuTqdgSeOsB5qpmILnrb6mYHioPfI=; b=GK/tVEYgxyUvQFbH1SFaI008Q6trqxRp+nDnHpWJh12YtgZvbGJk7hLGvDKtbMk0zL xwxFOvtPy5Xws67MVe0W3I1aNVjzUyGZyPf3+O1fQL3ZgDQjB7hbdqzibnwyeKrAcu0N cSC1DwRNG2Bi/kRBZPruIAUWTmK9G9R9L61HhNugyhWORaHFD6KuBK2n54VgavYyRtWX xWjRuUE9N4UFyNalIs+WgArU0ULJWBg5CFsNz+up0sQflSRhtjbfTo3eED7zMHqY7CCh TxoVqGs1HEsiyMx/GajB/vBzL9/2K0vzgb4+KGOfFP61CG2M2VeinnQQud5jG93QQ3vr XM4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=hWyoQ03AyiBHBWIuTqdgSeOsB5qpmILnrb6mYHioPfI=; b=B92JQzeflkcu92V+OqPW7F8wowvLhRSW2P0DojxXU6cOso6hsWTvpRaIVxZfFVurMN kpHXGM9KvZW7fbRe0s9XTD6ggIYbAxbG8K0Arc7wepDtGiN9rAlNg4PCuJTgzUJ6PPM/ xTGDd2mHkECkR8aoI8WrJafLhw1zlbzjyIsQBSc9XAWvgYfscGUR/ZGNYQJbYTQkk46x /oiiR6QvqWe7+nVH/TOMBJtkO1tRb7EpqvSPTq9GjQGetFomPDs3dD5HJ390H+zDw6Z+ 3svc+qMTfWdh+3WEq2WYfuPrfcDZyxLQEJ0UYOVcZ4s6301kaaWsOtsImReIpFSzX/De AKFw== X-Gm-Message-State: AOAM530mfEasVh7AYRNQRxsfbUdLMyLLexwofPdddz7yJo2+jCCwhJgo 9//QYCWWTRF2yj98vDZfAGBXEw== X-Google-Smtp-Source: ABdhPJxuBtI+/+kQ5BUm3igh6ZDVewoV1vYV0z/0/tl6BZ5inncH5WbsQjgaDaLRdh5hJdL1dj1EgA== X-Received: by 2002:a17:906:7b53:: with SMTP id n19mr5897162ejo.538.1638952416319; Wed, 08 Dec 2021 00:33:36 -0800 (PST) Received: from localhost ([104.245.96.202]) by smtp.gmail.com with ESMTPSA id t5sm1564891edd.68.2021.12.08.00.33.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Dec 2021 00:33:36 -0800 (PST) From: Leo Yan To: "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 , Balbir Singh , 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 Cc: Leo Yan Subject: [PATCH v2 4/7] connector/cn_proc: Use task_is_in_init_pid_ns() Date: Wed, 8 Dec 2021 16:33:17 +0800 Message-Id: <20211208083320.472503-5-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211208083320.472503-1-leo.yan@linaro.org> References: <20211208083320.472503-1-leo.yan@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211208_003337_746717_B31FD1B6 X-CRM114-Status: GOOD ( 11.57 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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 Acked-by: Balbir Singh --- 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; /* Can only change if privileged. */