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 54369C433EF for ; Sun, 5 Dec 2021 14:53:21 +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=v3VLN5rxtuUH8T7UhR3XI5gyQ4pTr7fc/04n71fHrx0=; b=0aLjBnPlbM8gJo NUBChmq1PGD+/+88JKy64C7i5/KQPNHeIDu6uyYEvA5oR0MuTEHSTFkfY4YL4PqzvvwJlIBm9UBRX QFutqGaHyz2RIFG2bwzjP9/g+w9olx40zw8Az5kjiaDV8eJ2HoJNUxLyG0EYFfc6U29RkPGIL5ICK 3T2zWnMA9wn2dh8RYWXSerk0vpm1qNWgU4Rx3DA5HkxR2/kdT+88XiUKptsNVOIExSxaMUNuKaYT6 mEmRwC9eFiMxEjwsrANn7c604Wok2X/yWD+Ari2tk5Onm1akWfTmysjjk6vlFx3d3HpSszErg5MAk cbIeaGPjso0hKUpPlzjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mtsrx-001YG9-Co; Sun, 05 Dec 2021 14:52:01 +0000 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mtsrT-001Y9E-BO for linux-arm-kernel@lists.infradead.org; Sun, 05 Dec 2021 14:51:32 +0000 Received: by mail-pg1-x534.google.com with SMTP id j11so8017561pgs.2 for ; Sun, 05 Dec 2021 06:51:31 -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=3LDDsH38QkceeUfcUldY6VFRPfPHtJesMGkSHVAh5YM=; b=f3fPCDNDHAaSIGPbUYS057ddh5pKujL9XVYkGT4eEig7wCM/t65G2aZKSXTDn/zR5X m5T/+pMCCs5rlWOOf+s2ocQZ7V16WVgz4DJ8NP+3yGnRL9TVsJ/ZWKqt3YXTnZMDYyhn 4lZ0B7y5iKOT/aj6AyagHYHph9TDHQCp1+kMfZ+Bpkv9qNZesc58bui4Kv5lafRwEd5c Y4DoyfsSszMrZ2Z/txZNZR/AzVByD905iRTYUkfJlKFC8A4m+j/SWLnjEUZolRYe+jcv 1zDI/cX8dGGp0oVBtZMmN3R24vooHnabpX22ZHu5jUGt0uh2jvLbgwjDxVongWQE/1gz 4W7A== 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=3LDDsH38QkceeUfcUldY6VFRPfPHtJesMGkSHVAh5YM=; b=3LmMMeRA9PED/uLZF6Uk0Wbx6hOs7HbQjGTHt4ECHwb/dGs3jsDrrNl5Tu72aVeqXH DQBejtlJLZ7EhE/EE9hoMMHMjfF5ViewSvkxNgcHGIb9Wsy3ltKBXw8rLXPDzSmNRmFF 20R3O+eSmBjGAtWjA8u2DQ6z+sIoI7KLdgVw5tNtE8vvlgUMb6UUK3O0zlni742Gd29R c2ZezdHtMfVAvzuEMSiavuVGpwK1hBC96xIkdEK+Kajl0JurVRBgKxunsl7TmKw8T9ev 1Z2YaF7JjVETz5qOYeF0hCCDiSqYpj0WGh1MaJwBd5d4ZEl2BnQ0Jf6CirPmn8RtQcQt xB3g== X-Gm-Message-State: AOAM531kN870X36+uHP7KxaSv7hvT0Ty4Ar4zfhL9XQgq2MdWvkZAdpk OGX8UmrN6jvEpA4bMYzdw9Ivwg== X-Google-Smtp-Source: ABdhPJyuJmKT3XfC+zhLm/KCB4bWKe9YooU6y1UfwRFRNjjlMVTSdo1heNNLMgTcMpJFMrBsLFPdqw== X-Received: by 2002:a63:6a83:: with SMTP id f125mr13999908pgc.340.1638715890495; Sun, 05 Dec 2021 06:51:30 -0800 (PST) Received: from localhost ([2602:feda:dd6:6f1c:af3b:f51c:baf0:62a]) by smtp.gmail.com with ESMTPSA id p124sm9212732pfg.110.2021.12.05.06.51.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Dec 2021 06:51:30 -0800 (PST) From: Leo Yan To: "David S. Miller" , Jakub Kicinski , 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 v1 4/7] connector/cn_proc: Use task_is_in_root_ns() to check PID namespace Date: Sun, 5 Dec 2021 22:51:02 +0800 Message-Id: <20211205145105.57824-5-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211205145105.57824-1-leo.yan@linaro.org> References: <20211205145105.57824-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-20211205_065131_417366_1765BD72 X-CRM114-Status: GOOD ( 11.77 ) 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 To avoid open code, this patch uses the helper task_is_in_root_ns() to check if 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..b8a4fa366b28 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_root_ns(current)) return; /* Can only change if privileged. */ -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel