Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp8401093rwr; Thu, 11 May 2023 00:14:55 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4MUnZaoGWPKQa+YFu924RC9qE0U7tcE0ZD+K42BHSvSBCSJ7h33hhoE57hdlfR5imvFUTA X-Received: by 2002:a05:6a00:189a:b0:646:7234:cbfc with SMTP id x26-20020a056a00189a00b006467234cbfcmr16656334pfh.27.1683789293777; Thu, 11 May 2023 00:14:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683789293; cv=none; d=google.com; s=arc-20160816; b=fcHyjmjPpCNx/CjZPUAVqbosKF3DcMWsAo2Y+zb11ODtAbN4cBBn5wab2Q/4YWg1Kx 8y2FkeEuayrmUfneSXkVmTmqfeSgbi3z/DBN3BmbULDacOsyUg1mPITBewzr/KsUG2ve v1jocG9hk7LlFOQpkjNc2hxX0NtCnIsfGC/DBCdCrG3kLJn5QA977l6sjNVSiiQZfCqv 5Y76sHmxezWOBZNa1c/WztOnhQ+v3ZCTOsNCMktrt5BjuzxBOhYQBSQs7EsNfhApLKn2 by4/VUGX3iUtgrfoaSCCZ9w/uSFe1iUAsnSwmk35TAcW8mdAHstYOVnEEQxEvANmDq5s aOYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=admBkFl5bbx2kCXUCfn9gdCHVW55Rdg39CdukhJ/+II=; b=sGl86mSMVc7V5Wf2pzJvF8MLQr4CeajF3bKbikKJT999M8XXg9wZkxpjh2HvoIo/99 wgZTO2Ze7PgztQP0FlVf6xLSpq3bhfo1TfvVGBdh10pmEZPBorgKDYpjEJ+4Hgd6fcon 2bBq5gyRmzGcTvExY80G/xiMjfTdMqITAycDVpD4DCkNsp9Xan7Dj+N/GDLq1dKfGa/5 QCm22+nXd79KZw2DBulWgVhxj9anKKwjJ5+eTJ1dSNSqYCtgj67IHk9gsGDgC1sLzCX7 yUZGR/c7FgGY+dQaktqIFHCdMHbcyIOcXRFbZwxg7Bwc+8HLZKfPwAN7ezdHtQZkLAaI r0pw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m125-20020a633f83000000b00528ca427963si6069376pga.709.2023.05.11.00.14.41; Thu, 11 May 2023 00:14:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237375AbjEKHGU (ORCPT + 99 others); Thu, 11 May 2023 03:06:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40314 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237200AbjEKHGJ (ORCPT ); Thu, 11 May 2023 03:06:09 -0400 Received: from out30-132.freemail.mail.aliyun.com (out30-132.freemail.mail.aliyun.com [115.124.30.132]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8AAFA6E87; Thu, 11 May 2023 00:05:32 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R111e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045168;MF=tianjia.zhang@linux.alibaba.com;NM=1;PH=DS;RN=12;SR=0;TI=SMTPD_---0ViJb7g-_1683788728; Received: from localhost(mailfrom:tianjia.zhang@linux.alibaba.com fp:SMTPD_---0ViJb7g-_1683788728) by smtp.aliyun-inc.com; Thu, 11 May 2023 15:05:29 +0800 From: Tianjia Zhang To: Serge Hallyn , Paul Moore , Stephen Smalley , Eric Paris , Frederick Lawler , Jens Axboe , Joseph Qi , linux-security-module@vger.kernel.org, selinux@vger.kernel.org, linux-block@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Tianjia Zhang Subject: [PATCH 2/2] block: use block_admin_capable() for Persistent Reservations Date: Thu, 11 May 2023 15:05:20 +0800 Message-Id: <20230511070520.72939-3-tianjia.zhang@linux.alibaba.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20230511070520.72939-1-tianjia.zhang@linux.alibaba.com> References: <20230511070520.72939-1-tianjia.zhang@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY, USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the newly introduced capability CAP_BLOCK_ADMIN for Persistent Reservations. Signed-off-by: Tianjia Zhang --- block/ioctl.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/block/ioctl.c b/block/ioctl.c index 9c5f637ff153..83af050eaa42 100644 --- a/block/ioctl.c +++ b/block/ioctl.c @@ -260,7 +260,7 @@ static int blkdev_pr_register(struct block_device *bdev, const struct pr_ops *ops = bdev->bd_disk->fops->pr_ops; struct pr_registration reg; - if (!capable(CAP_SYS_ADMIN)) + if (!block_admin_capable()) return -EPERM; if (!ops || !ops->pr_register) return -EOPNOTSUPP; @@ -278,7 +278,7 @@ static int blkdev_pr_reserve(struct block_device *bdev, const struct pr_ops *ops = bdev->bd_disk->fops->pr_ops; struct pr_reservation rsv; - if (!capable(CAP_SYS_ADMIN)) + if (!block_admin_capable()) return -EPERM; if (!ops || !ops->pr_reserve) return -EOPNOTSUPP; @@ -296,7 +296,7 @@ static int blkdev_pr_release(struct block_device *bdev, const struct pr_ops *ops = bdev->bd_disk->fops->pr_ops; struct pr_reservation rsv; - if (!capable(CAP_SYS_ADMIN)) + if (!block_admin_capable()) return -EPERM; if (!ops || !ops->pr_release) return -EOPNOTSUPP; @@ -314,7 +314,7 @@ static int blkdev_pr_preempt(struct block_device *bdev, const struct pr_ops *ops = bdev->bd_disk->fops->pr_ops; struct pr_preempt p; - if (!capable(CAP_SYS_ADMIN)) + if (!block_admin_capable()) return -EPERM; if (!ops || !ops->pr_preempt) return -EOPNOTSUPP; @@ -332,7 +332,7 @@ static int blkdev_pr_clear(struct block_device *bdev, const struct pr_ops *ops = bdev->bd_disk->fops->pr_ops; struct pr_clear c; - if (!capable(CAP_SYS_ADMIN)) + if (!block_admin_capable()) return -EPERM; if (!ops || !ops->pr_clear) return -EOPNOTSUPP; -- 2.24.3 (Apple Git-128)