From patchwork Sun Dec 5 14:51:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12694814 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 210E2C433F5 for ; Sun, 5 Dec 2021 14:54:04 +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=olmxkdG9PIgeZaMmDBa473F5BsLA7LuklZU7gYjgXSw=; b=wAkHcYQsFGIbkc ysIavji3hbNqOoNk/b28AAEEPrDsLnvyFUWAvVwMcT3QYtJadoDzzoLMCxFsPOKrSUSvEzoZNDwzQ N0uG1RNNPN+wBuY9jLl4mbXtmAXEhnWhdYEs8mDdq8UfGpfLJMMYZw3OrXvViWHxYoH6r15hTyKnX sjDLJqgJ8SJQ7GyVmqVLi3Hm0AjoF2prKYlTi62/ckNVGst6xCmg+Lh2IoFHO+fqFI7zFTNM9zqJd 3gxUKi3hVDqUQN2L+u2wljNUxv5Z8XBGHvCDZgFBGty0u+vtPZ7IIn8jMcH2kK2xgzka0RQ9G2O7N 9WBp3HlzOiZSuH2/QnfA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mtssf-001YYo-PU; Sun, 05 Dec 2021 14:52:46 +0000 Received: from mail-pg1-x52f.google.com ([2607:f8b0:4864:20::52f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mtsrh-001YDb-Pg for linux-arm-kernel@lists.infradead.org; Sun, 05 Dec 2021 14:51:47 +0000 Received: by mail-pg1-x52f.google.com with SMTP id l190so7984078pge.7 for ; Sun, 05 Dec 2021 06:51:45 -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=WoYH3kUyU3rR597Qe29Tyg1cbdekiS3zv4yqA77Ra+o=; b=PQrQcoOw1V9KP76uLbFLDEDyrU9vqBzJPlKj+pTPusgS4daHAq7p66wzfdvZqqIJc2 QRKtdzA1IbWpSH8mHpn027kXF9Mild4jnXfXrzwYxqZxzF9JDoK6kTv1YaFv05Il+rEv lIvw4Xq6j53moojd4Yjl4KoUFlH9LWXrmjmmWREieVyxw8BExrw3buKuSVltSk3mNAaz mh2fAPVWvCLZscc+IivAkObQD8K+H0FitLX6DJ4jpbHnoQAEwMEadj7f8xY8967azkF6 Q5w6kToRbIlON6L0NmISOYfuZ8vwO6RrksQaoigaYoCM56mEQPl8QUiaddf/27eSZl0n V4MQ== 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=WoYH3kUyU3rR597Qe29Tyg1cbdekiS3zv4yqA77Ra+o=; b=wq+HRZ4n0nLwW9MwiuQkPqe4c39LBytRta+ZBRRA5qE6l35HOpbzC2UqVy9cThSCxW YeqzbyYwNWTX0KAqTAZ1wc7gIZW8kow0le8IAiMuL67AUfKz3fmjuSqWYs5MMlWpiy9j Vm2yWivwlZmdOgihzEnzCUQgNmEC3ZXtyLMkSgCCyd+3TUwqBr2HlXWLH0SVnRAC7tZu YbSnjB18C6dGQO2tQ1UgXzGItHndOq+NpXU7/EI66OcDZuUrOhU+7NQcE40MMtwgFaga CApOQboWu51TzcGiBOMrFOwih80IGOBh9M+YXXvcF41SBBYNw5VOiGEowRfvGwHMAaDW wUwg== X-Gm-Message-State: AOAM531og+n/IXVRhqEE7BNDsun98/sqeviwainAq1GbeLA/9EwGJ7FT w81gR2stW3uTDpxUke8Ph4O+5Q== X-Google-Smtp-Source: ABdhPJycmQqaqKyYV6rADGSOztK52rZFL5guaz/TJWi/jAvOjSlm3KATDKooWY63M7hIdTmll6FeGw== X-Received: by 2002:aa7:8d0a:0:b0:4a2:82d7:1695 with SMTP id j10-20020aa78d0a000000b004a282d71695mr31790299pfe.86.1638715904962; Sun, 05 Dec 2021 06:51:44 -0800 (PST) Received: from localhost ([2602:feda:ddb:737a:816:168e:3e5a:d93]) by smtp.gmail.com with ESMTPSA id c3sm9960145pfv.67.2021.12.05.06.51.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Dec 2021 06:51:44 -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 7/7] taskstats: Use task_is_in_root_ns() Date: Sun, 5 Dec 2021 22:51:05 +0800 Message-Id: <20211205145105.57824-8-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_065145_853555_D3E884A4 X-CRM114-Status: GOOD ( 11.61 ) 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 Replace open coded checking root PID namespace with task_is_in_root_ns(). Signed-off-by: Leo Yan --- kernel/taskstats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 2b4898b4752e..c6a19d3911b3 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c @@ -284,7 +284,7 @@ static int add_del_listener(pid_t pid, const struct cpumask *mask, int isadd) if (current_user_ns() != &init_user_ns) return -EINVAL; - if (task_active_pid_ns(current) != &init_pid_ns) + if (!task_is_in_root_ns(current)) return -EINVAL; if (isadd == REGISTER) {