diff options
author | Yaniv Gardi <ygardi@codeaurora.org> | 2013-06-05 07:13:08 -0400 |
---|---|---|
committer | Chris Ball <cjb@laptop.org> | 2013-06-27 11:28:18 -0400 |
commit | a82e484e2480583b17be6253b985fa6f582ad20d (patch) | |
tree | 133eee2ef3cd1a755086c43bb8b2a2260f87835d /drivers/mmc/card | |
parent | 4d156d50b513116ba701b8d69d7fb870dd370481 (diff) |
mmc: card: fixing an false identification of SANITIZE command
Inside the routine mmc_blk_ioctl_cmd() the sanitize command is
identified according to the value of bits 16-23 of the argument.
but what happens if a different command is sent, and only by
chance, bits 16-23 contain the value of SANITIZE command ?
In that case a SANITIZE command will be falsely identified.
In order to prevent such a case, the condition is expanded and
now it also checks the opcode itself, and verifies that it is an
MMC_SWITCH opcode.
Signed-off-by: Yaniv Gardi <ygardi@codeaurora.org>
Signed-off-by: Chris Ball <cjb@laptop.org>
Diffstat (limited to 'drivers/mmc/card')
-rw-r--r-- | drivers/mmc/card/block.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 59a13fce774e..5411bf447369 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -542,7 +542,8 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev, | |||
542 | goto cmd_rel_host; | 542 | goto cmd_rel_host; |
543 | } | 543 | } |
544 | 544 | ||
545 | if (MMC_EXTRACT_INDEX_FROM_ARG(cmd.arg) == EXT_CSD_SANITIZE_START) { | 545 | if ((MMC_EXTRACT_INDEX_FROM_ARG(cmd.arg) == EXT_CSD_SANITIZE_START) && |
546 | (cmd.opcode == MMC_SWITCH)) { | ||
546 | err = ioctl_do_sanitize(card); | 547 | err = ioctl_do_sanitize(card); |
547 | 548 | ||
548 | if (err) | 549 | if (err) |