From 3eb611d9d7f383ff5e8ba750846a680880ae714f Mon Sep 17 00:00:00 2001 From: Yaniv Gardi Date: Wed, 5 Jun 2013 14:13:08 +0300 Subject: [PATCH] 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 Signed-off-by: Chris Ball --- drivers/mmc/card/block.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index 4fc0e386a5e9..5aff49a412c7 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c @@ -539,7 +539,8 @@ static int mmc_blk_ioctl_cmd(struct block_device *bdev, goto cmd_rel_host; } - if (MMC_EXTRACT_INDEX_FROM_ARG(cmd.arg) == EXT_CSD_SANITIZE_START) { + if ((MMC_EXTRACT_INDEX_FROM_ARG(cmd.arg) == EXT_CSD_SANITIZE_START) && + (cmd.opcode == MMC_SWITCH)) { err = ioctl_do_sanitize(card); if (err) -- 2.34.1