lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date:	Tue, 15 Mar 2016 11:26:07 -0400
From:	"Yin, Fengwei" <fengwei.yin@...aro.org>
To:	jonathanh@...dia.com, ulf.hansson@...aro.org,
	linux-kernel@...r.kernel.org
Cc:	fengwei.yin@...aro.org
Subject: [PATCH] mmc: block: remove the check for whole block device for ioctl.

From: Fengwei Yin <fengwei.yin@...aro.org>

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.

Signed-off-by: Fengwei Yin <fengwei.yin@...aro.org>
---
 drivers/mmc/card/block.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index fe207e5..72b9053 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -693,7 +693,7 @@ static int mmc_blk_ioctl(struct block_device *bdev, fmode_t mode,
 	 * whole block device, not on a partition.  This prevents overspray
 	 * between sibling partitions.
 	 */
-	if ((!capable(CAP_SYS_RAWIO)) || (bdev != bdev->bd_contains))
+	if (!capable(CAP_SYS_RAWIO))
 		return -EPERM;
 
 	switch (cmd) {
@@ -701,6 +701,9 @@ static int mmc_blk_ioctl(struct block_device *bdev, fmode_t mode,
 		return mmc_blk_ioctl_cmd(bdev,
 				(struct mmc_ioc_cmd __user *)arg);
 	case MMC_IOC_MULTI_CMD:
+        if (bdev != bdev->bd_contains)
+            return -EPERM;
+
 		return mmc_blk_ioctl_multi_cmd(bdev,
 				(struct mmc_ioc_multi_cmd __user *)arg);
 	default:
-- 
2.1.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ