提交 a82e484e 编写于 作者: Y Yaniv Gardi 提交者: Chris Ball

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: NYaniv Gardi <ygardi@codeaurora.org>
Signed-off-by: NChris Ball <cjb@laptop.org>
上级 4d156d50
......@@ -542,7 +542,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)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册