From: Huang, Tao Date: Fri, 4 Mar 2016 09:06:12 +0000 (+0800) Subject: mmc: block: ioctl return EINVAL if cmd unknown X-Git-Tag: firefly_0821_release~3288 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=7c1abbfe2a27bae41202d4b46687f82eba0c1d5b;p=firefly-linux-kernel-4.4.55.git mmc: block: ioctl return EINVAL if cmd unknown We should return -EINVAL if cmd is not MMC_IOC_CMD or MMC_IOC_MULTI_CMD, otherwise blkdev_roset will return -EPERM. Android adb, make_block_device_writable ioctl BLKROSET will return error, make adb remount with error: remount of /system failed; couldn't make block device writable: Operation not permitted Change-Id: I7d0a5727110c0fd9ad301a377e5002eae23f8aed Fixes: a5f5774c55a2 ("mmc: block: Add new ioctl to send multi commands") Signed-off-by: Huang, Tao --- diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 7befdaee555a..6efc81ea5dc5 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -690,6 +690,11 @@ cmd_err: static int mmc_blk_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { +#ifdef CONFIG_ARCH_ROCKCHIP + if (cmd != MMC_IOC_CMD && cmd != MMC_IOC_MULTI_CMD) + return -EINVAL; +#endif + /* * The caller must have CAP_SYS_RAWIO, and must be calling this on the * whole block device, not on a partition. This prevents overspray