From patchwork Wed Dec 8 08:33:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12695302 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 58A92C433EF for ; Wed, 8 Dec 2021 08:36:53 +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=Jwflx5l3G455OMryTYDmfYdfoDPZBFkDX9VRrzQk7GY=; b=CSPFBgK2vQ2m59 iUoIVgYnJRpbx+qFyB7PyQ5ne6kvDAlvyRbpcHUz5k45Z1tdr4WeFip0YtvPuGkF1Qs4g8u5H128a 0sBecH4fNVfpuhQsXWl4noNBdMFj9YuqeXfd9A2YL2y+u9OvsknL7OJeumgySrUsCBCIH8mVuRBDd x6Fo0cy2Gr11tu0C8rlHkwh0CeerL9keqaV9dNRhaKX/XIiP+ptAyqEDsYVrU8MmvrdwEvVJsVXPW QNONLlYXrdMCb7wzCoNAidKzIimDpJBk98MvGiZBxZzmd6nmDYlWV+2+67SCWWEDGPohV/vTrxjsJ Nk97HNSKqIVb6l99UFag==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1musQ6-00Bim9-Dp; Wed, 08 Dec 2021 08:35:22 +0000 Received: from mail-ed1-x531.google.com ([2a00:1450:4864:20::531]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1musOY-00Bi4z-Bp for linux-arm-kernel@lists.infradead.org; Wed, 08 Dec 2021 08:33:47 +0000 Received: by mail-ed1-x531.google.com with SMTP id y12so5641265eda.12 for ; Wed, 08 Dec 2021 00:33: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=M/eeez3BcNi8tVHbYa2oBkvP6t/vK4B43HUQensSi3k=; b=Orp+rG52g6tM3+l/drNhrh6yzPRKPWZcTew2ozeopfwXTy+KpnrLnl684tWf9cNuId 90kmKsM3VRgMXWqcqdESh5J1AGweiDOXeVoQTaQS48SQ9Wry/FVDCuCK/RT/pbO9Yob/ rYfqQQycRbfrii9WQHGS+mEoTkl/Pm0Tfsv/OvzNw9fNjzIwVW42i+23ej2a7xId11CY glJ9F28NR3du8wtSsiCXLBpv8IGoJzuKkyjVSUsucqtdae/j7C0GaWmXZErgIOlHL9cD +Lqevqy4d/UggetMCsYR27VuZdjK35h10UgFe32dZVb00Uc1/SdZP8CLdokKIY/Etzwk Uhpw== 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=M/eeez3BcNi8tVHbYa2oBkvP6t/vK4B43HUQensSi3k=; b=tt8i7fxEc8Qdt9lAJlW+0zX0mXk9Qb85KhLIUlrL23HkqoovGfJOaJxnJpmu4BndUd aKpif8KWJwPdlvYlzUJdfvhaKmZJCwG96eRDU4K2COPY5Gw7mHliDGgWDur/bMDEYf/4 1syHndGGsI4Uq4oJ0zZtXYIkqw4mNkYILcyD3ZuIuI4xwxcQPOC2r/wbRS5RtR4jzc+G Fhheq2xmbMo3mpITjO4vF96LI2FO7h5aZg1jPmAE7a6wHMbon3Y0IlmQ/X/2MCu41uFj VX+lm9VpJlt0H+ZxkSGvZeL7LNzaQ6mCAOcVF6DFB73neRQ7S79uoIgUinYG52buFMB+ WnTQ== X-Gm-Message-State: AOAM531bZY7uf4Ac1OK+bJqgyMN0XoxhRK4MQYxRcmN7dD1J5NBq+UAX Pij9Q2y98z/65MFYrR8Cx0AtAg== X-Google-Smtp-Source: ABdhPJx1gsuPUNsaXFXbyVaebM4oFOMmmWAz5pvxHoEHLYLkpCRym4tCyOQ0c/34zl8r1AV4FxeNkQ== X-Received: by 2002:a05:6402:3496:: with SMTP id v22mr16781811edc.177.1638952424146; Wed, 08 Dec 2021 00:33:44 -0800 (PST) Received: from localhost ([104.245.96.202]) by smtp.gmail.com with ESMTPSA id h10sm1472866edr.95.2021.12.08.00.33.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Dec 2021 00:33:43 -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 7/7] taskstats: Use task_is_in_init_pid_ns() Date: Wed, 8 Dec 2021 16:33:20 +0800 Message-Id: <20211208083320.472503-8-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_003346_430125_11F8537B X-CRM114-Status: GOOD ( 12.19 ) 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 code with task_is_in_init_pid_ns() for checking root PID namespace. Signed-off-by: Leo Yan Acked-by: Balbir Singh --- kernel/taskstats.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 2b4898b4752e..f570d8e1f001 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_init_pid_ns(current)) return -EINVAL; if (isadd == REGISTER) {