From patchwork Wed Dec 8 08:33:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Leo Yan X-Patchwork-Id: 12695300 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 09225C433FE for ; Wed, 8 Dec 2021 08:36:14 +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=0Fak5JcacqK76A V8MUsS1I5x8eILWui/ebd2CQijY8stiqocWMM7Qevj1zyxDThgcZaFlq5LlP5NVqXr6GWDcOFfgOB cjpL8AZp7n1qQd4Ytdh/fIdjQuSoZeAoDfuVeBA3Ueppjg5DeOkjfyBF/z8zl+jvTOiTQhRzWeYi1 5ZT+GQENYfJt17flAO0ewNy1LOjNLxRJdkaaAU5xuqhKIzBri+HgOQ0YptARfI1KFi0zb+npfH3jp w67aT8q4chX7WEg2i/+jiYh4udbPBPFxHbmBf2B/2QAoW7tEaGglsPjHIDj0HJI4coEUVP+RmJd+u UeUWc1HnG7mGdHYXqrVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1musPG-00BiKQ-K7; Wed, 08 Dec 2021 08:34:30 +0000 Received: from mail-ed1-x530.google.com ([2a00:1450:4864:20::530]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1musOS-00Bi2a-Tr for linux-arm-kernel@lists.infradead.org; Wed, 08 Dec 2021 08:33:42 +0000 Received: by mail-ed1-x530.google.com with SMTP id z5so5822543edd.3 for ; Wed, 08 Dec 2021 00:33:40 -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=defM02iiv0IuxmhLtI7Q91bOiZbH9EqLeP10tH5ALqWf7R+haF+jgmUJ9uAyaKbBQK k3h8RCQOzjyxiA2Nt9jTqv9wJow4oQK1mOTwjiankLQ+2J92Ml5eYsOmSKs9HLE0TGhK nlz7h+3ca/HKUfg723Vt0Bal0l19de2P1lx1goPBgFEVtxjaSWVsvLWEHSWTXeYQNs0s C/V1RAckrBlIKHtfpw3tlSk4ncANDAe+YfGbE98zhwCu9y5wUNNORJyNtXRZr6DNPysi YQfk/eqDVG94A41nzcjytS3Go9SvHW+T/dD70WTpUSNgtWIgl/jKmiaK428o8YJ7V7YD Z9vQ== 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=Yv3mEPhhZzRSFoa+MHe1owk6ySED3YWMIyrxjADTQXIIiqSMzU2R7yBPO1o+AQZyZF bw/iHO8004hzPnFnSuz4zYA/mkk1sSzBtGe0+3Xpps3xmLZbas140EmjWvW7Oh0L0osR 4ma2COtNlaTiY/riSPzaHQNgTF7xznccfUPsqz2+fsBW9R7I/aojpe3NbWNOjxxORdq7 zjxa1lzYmRbGF36Q6QPsNSp0QDfnoJHEVD3iCNO67h2ZdkoN/mxDufOKbarN48+c0hoY 0FBIH2FB6q0ieTDfMjzuRCGMNWW+klzxxAJ3kbxnIGX3xNfYAd9mphoyxY8cFFeYndjB 5fQg== X-Gm-Message-State: AOAM531R4tRBdshK0BdXzqBDTXdf9IOtFpPh169ueMl5/qg9YC0E1K6Z l3JHJfDUm+s2b4aCXujb0G5zhw== X-Google-Smtp-Source: ABdhPJz4wjRib7Te/OFIfhE1RhBahkANQSzD5tFXSlekwOc7sbVMSqZYx/8aXbTYVdMw6+UCNgG39g== X-Received: by 2002:a50:fd16:: with SMTP id i22mr17261360eds.224.1638952418992; Wed, 08 Dec 2021 00:33:38 -0800 (PST) Received: from localhost ([104.245.96.202]) by smtp.gmail.com with ESMTPSA id f7sm1491975edw.44.2021.12.08.00.33.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Dec 2021 00:33:38 -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 5/7] coda: Use task_is_in_init_pid_ns() Date: Wed, 8 Dec 2021 16:33:18 +0800 Message-Id: <20211208083320.472503-6-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_003341_005439_BD48374D X-CRM114-Status: GOOD ( 12.60 ) 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)