From 1ac109ddc959f404e18addac24c6ddff6586cf48 Mon Sep 17 00:00:00 2001 From: Wolfram Sang Date: Mon, 25 Jan 2016 20:20:04 +0100 Subject: mmc: mmc_test: mention that '0' runs all tests I had to use the source to determine what I need to write to 'test' so that all tests are run. Let's mention this explicitly in 'testlist'. Signed-off-by: Wolfram Sang Signed-off-by: Ulf Hansson --- drivers/mmc/card/mmc_test.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers/mmc/card') diff --git a/drivers/mmc/card/mmc_test.c b/drivers/mmc/card/mmc_test.c index 7fc9174d4619..c032eef45762 100644 --- a/drivers/mmc/card/mmc_test.c +++ b/drivers/mmc/card/mmc_test.c @@ -2829,6 +2829,7 @@ static int mtf_testlist_show(struct seq_file *sf, void *data) mutex_lock(&mmc_test_lock); + seq_printf(sf, "0:\tRun all tests\n"); for (i = 0; i < ARRAY_SIZE(mmc_test_cases); i++) seq_printf(sf, "%d:\t%s\n", i+1, mmc_test_cases[i].name); -- cgit v1.2.3 From f53f1102950072e4c2548d1fd01de6aadb2202bd Mon Sep 17 00:00:00 2001 From: Jaehoon Chung Date: Mon, 1 Feb 2016 21:07:36 +0900 Subject: mmc: block: don't use the OR operation for flag of data After removed the MMC_DATA_STREAM, only two flags are remained. (MMC_DATA_READ and MMC_DATA_WRITE) The flags of READ and WRITE can't be used together. That's why it doesn't need to use "OR' operation. Signed-off-by: Jaehoon Chung Signed-off-by: Ulf Hansson --- drivers/mmc/card/block.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'drivers/mmc/card') diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index fe207e542032..16d6597740b9 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -1524,13 +1524,13 @@ static void mmc_blk_rw_rq_prep(struct mmc_queue_req *mqrq, } if (rq_data_dir(req) == READ) { brq->cmd.opcode = readcmd; - brq->data.flags |= MMC_DATA_READ; + brq->data.flags = MMC_DATA_READ; if (brq->mrq.stop) brq->stop.flags = MMC_RSP_SPI_R1 | MMC_RSP_R1 | MMC_CMD_AC; } else { brq->cmd.opcode = writecmd; - brq->data.flags |= MMC_DATA_WRITE; + brq->data.flags = MMC_DATA_WRITE; if (brq->mrq.stop) brq->stop.flags = MMC_RSP_SPI_R1B | MMC_RSP_R1B | MMC_CMD_AC; @@ -1799,7 +1799,7 @@ static void mmc_blk_packed_hdr_wrq_prep(struct mmc_queue_req *mqrq, brq->data.blksz = 512; brq->data.blocks = packed->blocks + hdr_blocks; - brq->data.flags |= MMC_DATA_WRITE; + brq->data.flags = MMC_DATA_WRITE; brq->stop.opcode = MMC_STOP_TRANSMISSION; brq->stop.arg = 0; -- cgit v1.2.3 From 09faf61d1c3f70866a2f0864c00df6daaff52012 Mon Sep 17 00:00:00 2001 From: Russell King Date: Fri, 29 Jan 2016 09:44:00 +0000 Subject: mmc: block: shut up "retrying because a re-tune was needed" message Re-tuning is part of standard requirements for the higher speed SD card protocols, and is not an error when this occurs. When we retry a command due to a retune, we should not print a message to the kernel log. Signed-off-by: Russell King Signed-off-by: Ulf Hansson --- drivers/mmc/card/block.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/mmc/card') diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 16d6597740b9..47bc87dafb00 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -1362,8 +1362,8 @@ static int mmc_blk_err_check(struct mmc_card *card, if (brq->data.error) { if (need_retune && !brq->retune_retry_done) { - pr_info("%s: retrying because a re-tune was needed\n", - req->rq_disk->disk_name); + pr_debug("%s: retrying because a re-tune was needed\n", + req->rq_disk->disk_name); brq->retune_retry_done = 1; return MMC_BLK_RETRY; } -- cgit v1.2.3 From 83c742c344c08c2bbe338d45c6ec63110e9d5e3d Mon Sep 17 00:00:00 2001 From: Shawn Lin Date: Wed, 16 Mar 2016 18:15:47 +0800 Subject: mmc: block: fix ABI regression of mmc_blk_ioctl If mmc_blk_ioctl returns -EINVAL, blkdev_ioctl continues to work without returning err to user-space. But now we check CAP_SYS_RAWIO firstly, so we return -EPERM to blkdev_ioctl, which make blkdev_ioctl return -EPERM to user-space directly. So this will break all the ioctl with BLKROSET. Now we find Android-adb suffer it for the following log: 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 Signed-off-by: Ulf Hansson --- drivers/mmc/card/block.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'drivers/mmc/card') diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 47bc87dafb00..3bdbe50a363f 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -589,6 +589,14 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev, struct mmc_card *card; int err = 0, ioc_err = 0; + /* + * The caller must have CAP_SYS_RAWIO, and must be calling this on the + * whole block device, not on a partition. This prevents overspray + * between sibling partitions. + */ + if ((!capable(CAP_SYS_RAWIO)) || (bdev != bdev->bd_contains)) + return -EPERM; + idata = mmc_blk_ioctl_copy_from_user(ic_ptr); if (IS_ERR(idata)) return PTR_ERR(idata); @@ -631,6 +639,14 @@ static int mmc_blk_ioctl_multi_cmd(struct block_device *bdev, int i, err = 0, ioc_err = 0; __u64 num_of_cmds; + /* + * The caller must have CAP_SYS_RAWIO, and must be calling this on the + * whole block device, not on a partition. This prevents overspray + * between sibling partitions. + */ + if ((!capable(CAP_SYS_RAWIO)) || (bdev != bdev->bd_contains)) + return -EPERM; + if (copy_from_user(&num_of_cmds, &user->num_of_cmds, sizeof(num_of_cmds))) return -EFAULT; @@ -688,14 +704,6 @@ cmd_err: static int mmc_blk_ioctl(struct block_device *bdev, fmode_t mode, unsigned int cmd, unsigned long arg) { - /* - * The caller must have CAP_SYS_RAWIO, and must be calling this on the - * whole block device, not on a partition. This prevents overspray - * between sibling partitions. - */ - if ((!capable(CAP_SYS_RAWIO)) || (bdev != bdev->bd_contains)) - return -EPERM; - switch (cmd) { case MMC_IOC_CMD: return mmc_blk_ioctl_cmd(bdev, -- cgit v1.2.3