Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1667614pxb; Thu, 16 Sep 2021 12:28:31 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1aeBmkWhZ0myFDW0ZFA+F5Obrz7XpZ+XyhlNOsgTdNYPqc7wpNfjSsLqYymQcDq4tBeRg X-Received: by 2002:a17:906:3012:: with SMTP id 18mr8373357ejz.136.1631820510184; Thu, 16 Sep 2021 12:28:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631820510; cv=none; d=google.com; s=arc-20160816; b=g1kwlHm+JJN3xXqqVb9xBMse6h5CHsPC5cMg998pKNd2XbUwuw3qAKGArhrcweFajQ vL+bJ+1nf3Y9KdtaKAmKdfqeWM8+jGo8nMlh/CGL0JE995RF05U9wSM95bUPGjSw1szI aulAalNL1MIG2XpgoCqbhkqe1PJm0bT5hRAeTv3bB2s/JETaG4TuUmdPoh86a4rjbnqI 0MjxJDDu35FaKDUj/v2YqMjTqVkjAW460/e3oP8QI57pLEjqGmjOGGADc6rSZBWOfDS7 D1fBCp1D6jjAlbSyYLsu9sN0mvvtG5noNSP2BpJNkeaGbgijKCEuwPdsf4GzfASkNM0z bhoQ== 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=Y9omubPiVy8Sn1aW+dm5TxkhEpIFidORXm1yded7Bco=; b=jTNCyNQWVBKQYJfy3tR52P3hZ0FpdVt3iHv2aqkW1y1rP8OesfDSAPZu6GNS4kDFIJ +Nc+NJJoykfWdALRkvGnFK1zK+TWVdl95qEx5GoqLi6KcTGW6CdtsH0bqFmbnRg89Sdf G25RLzRmNTBOZab6hO51v8XbhSVL1CaGPQC3n3inGcggz82rmWdEKrBArlxdxSuQ+PcJ lfQlTsUh86wpYVDF4Wpj/TJEYYnuG9nDDI9dxpQ/sOZy3NJGtuSAUeCR6LxRpUtG/8Oy Co6dTmL6RottKbJm490kwFWpjMEG7srPU9W8qhw0+zrO7prwjSJF3i7HBf5ul1T749mR Nh5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=YCHAmlry; 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 m15si4395738edp.413.2021.09.16.12.28.06; Thu, 16 Sep 2021 12:28:30 -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=YCHAmlry; 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 S240508AbhIPQFO (ORCPT + 99 others); Thu, 16 Sep 2021 12:05:14 -0400 Received: from mail.kernel.org ([198.145.29.99]:44334 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240502AbhIPQFM (ORCPT ); Thu, 16 Sep 2021 12:05:12 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 2D2BE60232; Thu, 16 Sep 2021 16:03:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808231; bh=vIi+KtSITgBFVphFihL+2DklvZnOUJyzR4klBHNI5h8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YCHAmlryj8bY0sFh/OQ41JaZkPrlwiSsgTZo3Hf7AWya5frudjtWZCKtE3MDj2dLZ XiaIPKxNa8u/aK4JDalxW72vgkclGXGlVuCkUa3thtAm8EnZr9fNgKzNvrXxdrvjqC D5tTlTgRLP8NHyvSGXhUOhVHS65cQN13nyBggn0o= 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.10 010/306] blk-zoned: allow BLKREPORTZONE without CAP_SYS_ADMIN Date: Thu, 16 Sep 2021 17:55:55 +0200 Message-Id: <20210916155754.270690596@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@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 @@ -296,9 +296,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;