Message ID | 20210809094855.6226-2-Niklas.Cassel@wdc.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | allow blk-zoned ioctls without CAP_SYS_ADMIN | expand |
On 09/08/2021 11:50, Niklas Cassel wrote: > From: Niklas Cassel <niklas.cassel@wdc.com> > > Zone management send operations (BLKRESETZONE, BLKOPENZONE, BLKCLOSEZONE > and BLKFINISHZONE) should be allowed under the same permissions as write(). > (write() does not require CAP_SYS_ADMIN). > > Additionally, other ioctls like BLKSECDISCARD and BLKZEROOUT only check if > the fd was successfully opened with FMODE_WRITE. > (They do not require CAP_SYS_ADMIN). > > Currently, zone management send operations require both CAP_SYS_ADMIN > and that the fd was successfully opened with FMODE_WRITE. > > Remove the CAP_SYS_ADMIN requirement, so that zone management send > operations match the access control requirement of write(), BLKSECDISCARD > and BLKZEROOUT. > > Fixes: 3ed05a987e0f ("blk-zoned: implement ioctls") > Signed-off-by: Niklas Cassel <niklas.cassel@wdc.com> > Reviewed-by: Damien Le Moal <damien.lemoal@wdc.com> > Reviewed-by: Aravind Ramesh <aravind.ramesh@wdc.com> > Reviewed-by: Adam Manzanares <a.manzanares@samsung.com> > Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> > Cc: stable@vger.kernel.org # v4.10+ > --- Looks good, Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
diff --git a/block/blk-zoned.c b/block/blk-zoned.c index 86fce751bb17..8a60dbeb44be 100644 --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -421,9 +421,6 @@ int blkdev_zone_mgmt_ioctl(struct block_device *bdev, fmode_t mode, if (!blk_queue_is_zoned(q)) return -ENOTTY; - if (!capable(CAP_SYS_ADMIN)) - return -EACCES; - if (!(mode & FMODE_WRITE)) return -EBADF;