Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1913876pxb; Thu, 16 Sep 2021 20:05:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw/fi+C77iLk2GIsCBqJwyxElbSLpHghMDVt+UFK1GwWewgBLWCyp1UsVcC1UboVPd5fdDH X-Received: by 2002:a05:6402:17d5:: with SMTP id s21mr10109051edy.377.1631847941439; Thu, 16 Sep 2021 20:05:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631847941; cv=none; d=google.com; s=arc-20160816; b=daMsP7InX0GnFDk+hyT/2lQUsqJwKz1+W6neIXhnxF2AHqRxQgWLFkrIEqGjxMD2II Maa72YecmQrmHjIK1vPdYQr+SdnMK+HVjbRxi8/J7DAmjq64spJlpnlK75ckW4TIGu/5 /aU+GHjqpea1MwCKKl0WsOUHrq3Cpt4sHtEGt0ZFBuFvL+r0sTOoj/k0pbVl8ozZFK3q N5zhWdxqzyi+ztpCjKy1A0i0NwwMT/TURiTx65Qk7tEPqdP5uIzBMOWzeXjPG6rADV0p MzMKtIkrgVSHjzAwVLkmBN9unUWle0lvArkR7FNL/n7m6d07UKPf8dco0J8vktustWd2 we1A== 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=cLqD/Bo8NpNIIFUEm38gVTkV/Vq8wD0FJqW8SrhLdT8=; b=Vu26aeBtB4YdcGvkqWDJpe+xysbYWGz95ixn0y1k91umyeCups7Ii6YMdGmd+I5ZVw DdKc4x+3/E18teBvVHJaq7Phfpfx2rYLOYZN/jcAefmBj9LxkQ2P62uECEtBx4E+Osgb tHY0UUGMHbmaJPCqE9FVxaE1SEJzqzv4fZAjhGYucK3n/CIbYEUy+Zx52fn9VUS+yqCX HuqRPMUideVeKb1LlUwciif9aKV40ajQw+XXIO4tHmZHj5gq+v0P8jzM5kKdK4scrsI7 GHqE/IKkYbSqs2GHFAMlFP5E6G+SkfUvC0tZ74bRafeYkXk60kfcGCrHfjJ8NP82CbVz 3xuA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=qJQjC+gB; 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 f22si5523405ejj.770.2021.09.16.20.05.18; Thu, 16 Sep 2021 20:05:41 -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=qJQjC+gB; 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 S1347569AbhIPRW5 (ORCPT + 99 others); Thu, 16 Sep 2021 13:22:57 -0400 Received: from mail.kernel.org ([198.145.29.99]:34144 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1344585AbhIPRFI (ORCPT ); Thu, 16 Sep 2021 13:05:08 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 9C04861B05; Thu, 16 Sep 2021 16:35:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631810104; bh=svksFqPO639NFPonjWKK5dVNFar/G7TiOv7IFQ9IPKU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qJQjC+gBWzg3gRJeqjrgbd/n6/ZOUUoSFnjn/xfxrbQ1YSUDUqYZY4OmgdeN11akq Fcma0PjLZSOZKsD4U86Hof/buUZ8yhDYOOWlXIzcwGv5qv5Px5NV8OjZTvQuqZOxJl 05taVn/KAwpWoj+nxxGiyjndURMhv6xIOSCRKGXo= 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.14 019/432] blk-zoned: allow BLKREPORTZONE without CAP_SYS_ADMIN Date: Thu, 16 Sep 2021 17:56:08 +0200 Message-Id: <20210916155811.472254043@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155810.813340753@linuxfoundation.org> References: <20210916155810.813340753@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 4d643b66089591b4769bcdb6fd1bfeff2fe301b8 upstream. 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 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-3-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 @@ -360,9 +360,6 @@ int blkdev_report_zones_ioctl(struct blo 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;