Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1545803pxb; Thu, 16 Sep 2021 09:38:12 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwxj2dPVQi5VDF1jtCPc1hzguBxeHJkOBHLLf2N2Jt1kdDNCCdUN2fkTGNZ0dIld9PMgwjM X-Received: by 2002:a6b:1d0:: with SMTP id 199mr5109560iob.20.1631810292172; Thu, 16 Sep 2021 09:38:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631810292; cv=none; d=google.com; s=arc-20160816; b=N4Wq3HgzTCn10XsDqIAVCgMh2IoL7hyLPanjVY8CSJxz6C6L8LgHQYFU7Y03doJXJI KF/SYZMfZotsR69RhOi6geUsH3I8lnl++UNsvI2ZRuigBn+5vY/TY3yFCB89GKWb0AR+ EiQYwq3n2cKRpBh+5aw2md1ibFbRuFHDilLuCGIWlPpAT22AOP5kvUlWKznbGkpWUhsF WvoFHP2Q44iBJC3ZrWgms1jydU97de7prKmMASdlspNGVd7ZDjhAKibkdN9H4i+elKFn +4Ah8TIWJ990yX8VJE1hQl8mWqwqXwMcboYGc4/cUuaNxkHdyanaClhcRrd1YQ7HqL7S mokQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=EP3jehVyBYcyWu19eOQ4yopKT+dpR0C3O7Rjks6lnkY=; b=iOv8XBRQoupU8Nqcuvbk2noAmF3AIHzkGvU2cDkm5Y6szUtY5LgT8kjv2dPJbT4hgV JdcngjHr8RVSq+dqAEDk/pgt9mt/8eez7IksqCH7ojtRy32k6ZLwgwz5ys6dr4B5XMnM 3fbAMDaWyXw0dz0ntGEOWeDMmoLyDdareqDErCWJjErPmjSmqwBfRybEUFjf19TyQD4y UxpvTwUgB7iib7S4Tef3J3MpAIlvn/ypbKUFI98S+bErGYrDWlXFOoS6+BY8fkZ8K31B 6/gjPPSCkGFYp0ug/upU1UmavW/Taws7I+DuMsGFKOB7zieSCizDPNiN/fBbcjEXcKXP b4+w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OSiC+oMX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m1si2953526ila.78.2021.09.16.09.38.01; Thu, 16 Sep 2021 09:38:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=OSiC+oMX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242747AbhIPQhT (ORCPT + 99 others); Thu, 16 Sep 2021 12:37:19 -0400 Received: from mail.kernel.org ([198.145.29.99]:38452 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242902AbhIPQ3q (ORCPT ); Thu, 16 Sep 2021 12:29:46 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6A2EF611F2; Thu, 16 Sep 2021 16:18:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631809132; bh=LgAGABJRu0L/gu7ZDEYzHPvx4XHTMX5WAmzcbxqprmg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OSiC+oMX8xLSEPSQmRfxcTXtCMLil1S2WwR8elXDQT95ux/8XpKZQKqlU54T7llRI vJkbn6dfGBSNfy5X+0ORfUw2Noee6pqmwIJNXVgjptSRe74KZlRa0rHEWL8j4qX/nx 4HNo3pNRWfqmxvDwq3+M96TSu3J7qtZN8Uu+SYCk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Niklas Cassel , Damien Le Moal , Aravind Ramesh , Adam Manzanares , Himanshu Madhani , Johannes Thumshirn , Jens Axboe Subject: [PATCH 5.13 010/380] blk-zoned: allow zone management send operations without CAP_SYS_ADMIN Date: Thu, 16 Sep 2021 17:56:07 +0200 Message-Id: <20210916155804.323506315@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155803.966362085@linuxfoundation.org> References: <20210916155803.966362085@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Niklas Cassel commit ead3b768bb51259e3a5f2287ff5fc9041eb6f450 upstream. 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 Reviewed-by: Damien Le Moal Reviewed-by: Aravind Ramesh Reviewed-by: Adam Manzanares Reviewed-by: Himanshu Madhani Reviewed-by: Johannes Thumshirn Cc: stable@vger.kernel.org # v4.10+ Link: https://lore.kernel.org/r/20210811110505.29649-2-Niklas.Cassel@wdc.com Signed-off-by: Jens Axboe Signed-off-by: Greg Kroah-Hartman --- block/blk-zoned.c | 3 --- 1 file changed, 3 deletions(-) --- a/block/blk-zoned.c +++ b/block/blk-zoned.c @@ -349,9 +349,6 @@ int blkdev_zone_mgmt_ioctl(struct block_ if (!blk_queue_is_zoned(q)) return -ENOTTY; - if (!capable(CAP_SYS_ADMIN)) - return -EACCES; - if (!(mode & FMODE_WRITE)) return -EBADF;