Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934154AbcCOOby (ORCPT ); Tue, 15 Mar 2016 10:31:54 -0400 Received: from [198.137.202.9] ([198.137.202.9]:58110 "EHLO bombadil.infradead.org" rhost-flags-FAIL-FAIL-OK-OK) by vger.kernel.org with ESMTP id S933762AbcCOObv (ORCPT ); Tue, 15 Mar 2016 10:31:51 -0400 Date: Tue, 15 Mar 2016 07:31:01 -0700 From: Christoph Hellwig To: "Yin, Fengwei" Cc: jonathanh@nvidia.com, ulf.hansson@linaro.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] mmc: block: remove the check for whole block device for ioctl. Message-ID: <20160315143101.GA19497@infradead.org> References: <1458055567-27878-1-git-send-email-fengwei.yin@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1458055567-27878-1-git-send-email-fengwei.yin@linaro.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-SRS-Rewrite: SMTP reverse-path rewritten from by bombadil.infradead.org. See http://www.infradead.org/rpr.html Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 836 Lines: 20 On Tue, Mar 15, 2016 at 11:26:07AM -0400, Yin, Fengwei wrote: > From: Fengwei Yin > > a5f5774c55a2e3ed75f4d6c5556b7bfcb726e6f0 introduced the whole block > device checking for MMC_IOC_CMD while the old code has no such check. > > It breaks some ioctl call like BLKROSET from user space. An example > is "adb remount" cmd. It prints out following error message: > "remount of /system failed; couldn't make block device XXXX writable: \ > Operation not permitted." > while the command worked fine. > > This change move the whole block device checking only for MMC_IOC_MULTI_CMD. I think mmc_blk_ioctl_cmd will need this as well, as will probably do any new ioctl. So I think the right fix is to simply return -EINVAL instead of EPERM if on a partition, which will make all the block layer ioctls works fine.