[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230511070520.72939-3-tianjia.zhang@linux.alibaba.com>
Date: Thu, 11 May 2023 15:05:20 +0800
From: Tianjia Zhang <tianjia.zhang@...ux.alibaba.com>
To: Serge Hallyn <serge@...lyn.com>, Paul Moore <paul@...l-moore.com>,
Stephen Smalley <stephen.smalley.work@...il.com>,
Eric Paris <eparis@...isplace.org>,
Frederick Lawler <fred@...udflare.com>,
Jens Axboe <axboe@...nel.dk>,
Joseph Qi <joseph.qi@...ux.alibaba.com>,
linux-security-module@...r.kernel.org, selinux@...r.kernel.org,
linux-block@...r.kernel.org, linux-kernel@...r.kernel.org
Cc: Tianjia Zhang <tianjia.zhang@...ux.alibaba.com>
Subject: [PATCH 2/2] block: use block_admin_capable() for Persistent Reservations
Use the newly introduced capability CAP_BLOCK_ADMIN for Persistent
Reservations.
Signed-off-by: Tianjia Zhang <tianjia.zhang@...ux.alibaba.com>
---
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)
Powered by blists - more mailing lists