From patchwork Fri Feb 4 13:50:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12735091 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 93E48C433F5 for ; Fri, 4 Feb 2022 13:52:58 +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=RUa0+KUYb0oH+g/qbxCVWat7AZ8b8omYioXMKui95oY=; b=GVJkWnY2UnConm aHoNFoj/1Rwwt6u+BXCLz0D0kIxIFLrO9X+sLifIb0uklIzCzlMc3Xm2BfgDtxe+yJFiSoI9donKF H9i91YtdRPO0gx9p+/itZiZ/Le1/hvH9TZKyCg+nb3IMhgkvbbbaSaNq729cqx3ILsL1JD+fcqM6r F6i08/jfCIAtkhk+f5eXQtfiqYFG94baydRORoMd3K96HtAfKD7PndgzTSMVj1tpTkXQ9hasD4LjT 5AMFQLq74PelaiP54jAwgSvwtHTD+02DroH3QwSeUk+yCEJQAlKLteQ4VkJ456sSTbvhNeipDtZZ/ ClDWwjPYs9ZwIdbGRdHw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFz07-004RhB-QH; Fri, 04 Feb 2022 13:51:47 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFyzl-004RaE-DF for linux-arm-kernel@lists.infradead.org; Fri, 04 Feb 2022 13:51:26 +0000 Received: by mail-pj1-x102e.google.com with SMTP id h20-20020a17090adb9400b001b518bf99ffso13157787pjv.1 for ; Fri, 04 Feb 2022 05:51:24 -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=kWkrWIVd0/tR6K54G/x68wI67h0lySobA9zdXOmvIu4=; b=ZjDAUHdvFm23PkDB88Y/g/RhqrfOS166LoUKOx5kLqEJVAfTEptWR30Yy2o02xcBjs wWzsXg6LJBvz2Eat79+CLZwuDAa5aoD1sDJzsb/MRdCQx2nHa09K5nmMa2HzN9rNEN1y J9OzGZ6bq3MFnXpMWCX7R9JFQjyx7xvrQ41jU8/5AdjHE1o5eKyePd3Op9HPm896ducL p8AF+I806JejVmLZBkheAgZhisIt4LuDOmBb5FIo7FHALMGh6CxXztZcc6LzBawUefz3 8zJA0OKFevHfdUBGrMQNdgDBIyMavlG5FwYJk4SmYkq9jrHTLj89FeyKimQ032V1T5Zm C2vg== 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=kWkrWIVd0/tR6K54G/x68wI67h0lySobA9zdXOmvIu4=; b=Cx7Bu0v/vulRPRer/NnO2TpjPHA3nchbH3A/trbu19JScoxU1Vi4O0skuDiH8YrVrg spIYprAT2OE8eWihVn+Vo/mEIAYKrS8bcMvWeS/TtJ4bgG4dUbeI/NNdnN5IAMZ2V+T5 B14vAvUicEJns9+2o3+FWWZZKkVC+AmKoXnwUJgqT4mONLDWVxLPl+60bj7tAwoGYgcI T3iFktczb+Tcr8eixZFJ9MZaQU9Eenj1PO9JvIYet5dVpIejTlg66TUL6iIn02jQvjSz gS17U07RpfrC0v5esfKtYPAUjCxZRMdYiJ1dV3HyOF1L0F0jwKM34OdNgMnyDalFU2PA 1R2g== X-Gm-Message-State: AOAM533Xc7wifh/T3ZXUGSolxgNR0JQgN+1rrmRRk6DkmisjEqJMQx9b R8WJJ6ab2faz09D4a49TLvqkmw== X-Google-Smtp-Source: ABdhPJzzlHgPllMAQLi0+cpFqx1ccciJ1GkPw437Mdlv75oiqnu9xqBhEbHOtdYvZHhrvF3MASLJ0g== X-Received: by 2002:a17:902:db0b:: with SMTP id m11mr3093004plx.104.1643982684308; Fri, 04 Feb 2022 05:51:24 -0800 (PST) Received: from localhost.localdomain ([134.195.101.46]) by smtp.gmail.com with ESMTPSA id 13sm2668131pfm.161.2022.02.04.05.51.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Feb 2022 05:51:23 -0800 (PST) From: Leo Yan To: Mathieu Poirier , Suzuki K Poulose , Mike Leach , Alexander Shishkin , Jan Harkes , coda@cs.cmu.edu, Paul Moore , Eric Paris , Balbir Singh , coresight@lists.linaro.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, codalist@coda.cs.cmu.edu, linux-audit@redhat.com Cc: Leo Yan Subject: [PATCH v4 3/5] coda: Use task_is_in_init_pid_ns() Date: Fri, 4 Feb 2022 21:50:49 +0800 Message-Id: <20220204135051.60639-4-leo.yan@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204135051.60639-1-leo.yan@linaro.org> References: <20220204135051.60639-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-20220204_055125_466372_82A3B8DA X-CRM114-Status: GOOD ( 12.25 ) 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 --- 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..931f4560fdd0 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_init_pid_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..73457661fbe8 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_init_pid_ns(current)) return -EINVAL; if (current_user_ns() != &init_user_ns)