From patchwork Sun Dec 5 14:51:03 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12694812 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 86A6BC433EF for ; Sun, 5 Dec 2021 14:53:35 +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=UbjwoEqPhmZ+ooIKvVz4QbWtPeAwuglHXGKCUlHTtME=; b=FvXTjsmEH//mrt LlU3txnl+BiTL0xUYPZDuWx8d9ESTaZ9xlkvBdN5MNyEFAOfUMxVaX2vVX4DGFL3YI05JwBfM7Yac 8kUN8gvOJNfZ37p+a/MA3mfZQxkPbGl0lIfWv3OdPmwhTbAziqwwOaOB9OK9eY4e+jm6Luf1wRSAa iaKO4kb718o/F9U9/gKjRuPEornwYg/GIh1ag6Yf6SmRtlEJHBU0ueLGPu1/68aDZNGcqy8JibJPM pvGIKG1fnqlafZJ6dn+B0rQRldAlMm4VtAONQO2KKkAJwhu2vIa8l5+GeHzpQ32JTzwShUW2eUFuU MtYqHHHRf/uKe///hffA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mtss9-001YKI-U5; Sun, 05 Dec 2021 14:52:14 +0000 Received: from mail-pj1-x1029.google.com ([2607:f8b0:4864:20::1029]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mtsrY-001YAH-3F for linux-arm-kernel@lists.infradead.org; Sun, 05 Dec 2021 14:51:37 +0000 Received: by mail-pj1-x1029.google.com with SMTP id y14-20020a17090a2b4e00b001a5824f4918so8842400pjc.4 for ; Sun, 05 Dec 2021 06:51:35 -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=LxgaAqKPfY9+Fs9lU8SAVq20rT6hH9OdOm/kBs8bn3Q=; b=EGa7KxHBtggk+Rt/PaGDK60Ju5BJXpK5BICGg1t9YLhhLSgWFEbDxCeP6p2bnbMPGw 8NA0bwcpajU/GsYvoZSlTHwfAA+hqBSz+dqJXTB0yNbQlNZeANFqPv9cS1GnJf8nuWKQ dHkqQ7W5plSFalua9EQlzAoYGcZ4R7C6xS943c+/rF8QupsRxzqdWp32jPHgy23A16vx QhZ5WkRQlFdsHQy5SWANoxuN+0Ic2vX+Ewz9RTFITW+g056VdCViMP7aDzHklEHPP1oh mXHUybqyppw9ZPsCm/nTxE/hl7tYOE1zOnRg3kgHjDv9thUoHuMDnmjRYE1hGNge5CvS XZPQ== 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=LxgaAqKPfY9+Fs9lU8SAVq20rT6hH9OdOm/kBs8bn3Q=; b=ahBZLigP7/fLwSVISDr6ulMcQmFV9UssvmTk1DCwx7bU64flzFZYJDQeppKuT9vfGv MTH5+YEEqdRz8AgW0op85OkNFfxMIi48WvAAi0WgWVf2Jy4OLOtsInJ3LxmpMSVl2liM CqZC9XlGnjfvafTi+vT3KeNFVsCksP7C++bRfeqwWBFsjq4ZlBPD//Vn/ejWjYmB8quW WNd7GHScT0p1HhChD3NOgTUKiSB0IOZAu75iHE0cHOAmQIZZoZXkn1iP9xW5gtk/lWBm YQv06zPxGcuAlHrLPgrCdThFFq3aBhChtDkqO2xb1Nqrhx9UhhbHIZMkLBpNg3o/pbR3 zgQg== X-Gm-Message-State: AOAM533yV346NlLfetXaBTsdmSNa1MTPGRwFwcngfzdVbppkMIKPVvJ+ lEOvsd2SZs2Hxc3IuowgVse3XQ== X-Google-Smtp-Source: ABdhPJyhz7mhy7c/6gh3uw7e17BV124wmThyRYdSZZNNApgX+01Pi1PcCXUsHi1AFphndxNGVWNNQQ== X-Received: by 2002:a17:90b:155:: with SMTP id em21mr30713254pjb.12.1638715895026; Sun, 05 Dec 2021 06:51:35 -0800 (PST) Received: from localhost ([2602:feda:ddd:e0c7:4151:8a98:ebd2:b9e3]) by smtp.gmail.com with ESMTPSA id o16sm10043005pfu.72.2021.12.05.06.51.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 Dec 2021 06:51:34 -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 5/7] coda: Use task_is_in_root_ns() Date: Sun, 5 Dec 2021 22:51:03 +0800 Message-Id: <20211205145105.57824-6-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_065136_163206_8DFEEAD8 X-CRM114-Status: GOOD ( 12.02 ) 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 --- fs/coda/inode.c | 2 +- fs/coda/psdev.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/coda/inode.c b/fs/coda/inode.c index d9f1bd7153df..a7d630ac522e 100644 --- a/fs/coda/inode.c +++ b/fs/coda/inode.c @@ -152,7 +152,7 @@ static int coda_fill_super(struct super_block *sb, void *data, int silent) int error; int idx; - if (task_active_pid_ns(current) != &init_pid_ns) + if (!task_is_in_root_ns(current)) return -EINVAL; idx = get_device_index((struct coda_mount_data *) data); diff --git a/fs/coda/psdev.c b/fs/coda/psdev.c index b39580ad4ce5..54db13bf2e06 100644 --- a/fs/coda/psdev.c +++ b/fs/coda/psdev.c @@ -270,7 +270,7 @@ static int coda_psdev_open(struct inode * inode, struct file * file) struct venus_comm *vcp; int idx, err; - if (task_active_pid_ns(current) != &init_pid_ns) + if (!task_is_in_root_ns(current)) return -EINVAL; if (current_user_ns() != &init_user_ns)