linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESENT PATCH] mmc: block: fix ABI regression of mmc_blk_ioctl
@ 2016-03-07  6:59 Shawn Lin
  2016-03-09  7:55 ` John Stultz
  2016-03-09 10:50 ` Jon Hunter
  0 siblings, 2 replies; 5+ messages in thread
From: Shawn Lin @ 2016-03-07  6:59 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Seshagiri Holi, Jon Hunter, linux-mmc, linux-kernel, Shawn Lin,
	stable

We should return -EINVAL if cmd is not MMC_IOC_CMD or MMC_IOC_MULTI_CMD,
otherwise blkdev_roset will return -EPERM.

Android-adb calls make_block_device_writable with ioctl(BLKROSET), which
will return error, make remount failed:
remount of /system failed;
couldn't make block device writable: Operation not permitted

openat(AT_FDCWD, "/dev/block/platform/ff420000.dwmmc/by-name/system", O_RDONLY) = 3
ioctl(3, BLKROSET, 0)  = -1 EPERM (Operation not permitted)

Fixes: a5f5774c55a2 ("mmc: block: Add new ioctl to send multi commands")
Cc: stable@vger.kernel.org
Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
---

 drivers/mmc/card/block.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 47bc87d..170f099 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -688,6 +688,9 @@ cmd_err:
 static int mmc_blk_ioctl(struct block_device *bdev, fmode_t mode,
 	unsigned int cmd, unsigned long arg)
 {
+	if (cmd != MMC_IOC_CMD && cmd != MMC_IOC_MULTI_CMD)
+		return -EINVAL;
+
 	/*
 	 * The caller must have CAP_SYS_RAWIO, and must be calling this on the
 	 * whole block device, not on a partition.  This prevents overspray
-- 
2.3.7

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-03-16  9:21 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-03-07  6:59 [RESENT PATCH] mmc: block: fix ABI regression of mmc_blk_ioctl Shawn Lin
2016-03-09  7:55 ` John Stultz
2016-03-09 10:50 ` Jon Hunter
2016-03-09 13:51   ` Shawn Lin
2016-03-16  9:21     ` Ulf Hansson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).