Thread (3 messages) 3 messages, 2 authors, 2021-08-09
STALE1789d REVIEWED: 4 (0M)
Revisions (5)
  1. v1 [diff vs current]
  2. v2 [diff vs current]
  3. v3 [diff vs current]
  4. v4 current
  5. v5 [diff vs current]

[PATCH v4 2/2] blk-zoned: allow BLKREPORTZONE without CAP_SYS_ADMIN

From: Niklas Cassel <hidden>
Date: 2021-08-09 09:50:35
Also in: linux-block, lkml
Subsystem: block layer, the rest, zoned block device (block layer) · Maintainers: Jens Axboe, Linus Torvalds, Damien Le Moal

From: Niklas Cassel <redacted>

A user space process should not need the CAP_SYS_ADMIN capability set
in order to perform a BLKREPORTZONE ioctl.

Getting the zone report is required in order to get the write pointer.
Neither read() nor write() requires CAP_SYS_ADMIN, so it is reasonable
that a user space process that can read/write from/to the device, also
can get the write pointer. (Since e.g. writes have to be at the write
pointer.)

Fixes: 3ed05a987e0f ("blk-zoned: implement ioctls")
Signed-off-by: Niklas Cassel <redacted>
Reviewed-by: Damien Le Moal <redacted>
Reviewed-by: Aravind Ramesh <redacted>
Reviewed-by: Adam Manzanares <redacted>
Reviewed-by: Himanshu Madhani <redacted>
Cc: stable@vger.kernel.org # v4.10+
---
Changes since v3:
-Picked up additional Reviewed-by tags.

 block/blk-zoned.c | 3 ---
 1 file changed, 3 deletions(-)
diff --git a/block/blk-zoned.c b/block/blk-zoned.c
index 8a60dbeb44be..1d0c76c18fc5 100644
--- a/block/blk-zoned.c
+++ b/block/blk-zoned.c
@@ -360,9 +360,6 @@ int blkdev_report_zones_ioctl(struct block_device *bdev, fmode_t mode,
 	if (!blk_queue_is_zoned(q))
 		return -ENOTTY;
 
-	if (!capable(CAP_SYS_ADMIN))
-		return -EACCES;
-
 	if (copy_from_user(&rep, argp, sizeof(struct blk_zone_report)))
 		return -EFAULT;
 
-- 
2.31.1
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help