From: Chris Ball <cjb@laptop.org>
To: Yaniv Gardi <ygardi@codeaurora.org>
Cc: linux-mmc@vger.kernel.org, linux-arm-msm@vger.kernel.org,
linux-kernel@vger.kernel.org (open list)
Subject: Re: [PATCH v1] mmc: card: fixing an false identification of SANITIZE command
Date: Thu, 27 Jun 2013 11:28:32 -0400 [thread overview]
Message-ID: <874ncjpo7z.fsf@octavius.laptop.org> (raw)
In-Reply-To: <1370430804-5663-1-git-send-email-ygardi@codeaurora.org> (Yaniv Gardi's message of "Wed, 5 Jun 2013 14:13:08 +0300")
Hi Yaniv,
On Wed, Jun 05 2013, Yaniv Gardi wrote:
> 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>
> ---
> drivers/mmc/card/block.c | 4 +++-
> 1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
> index c900d28..9775ae7 100644
> --- a/drivers/mmc/card/block.c
> +++ b/drivers/mmc/card/block.c
> @@ -542,7 +542,9 @@ 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)
Thanks, pushed to mmc-next for 3.11.
- Chris.
--
Chris Ball <cjb@laptop.org> <http://printf.net/>
One Laptop Per Child
prev parent reply other threads:[~2013-06-27 15:28 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-06-05 11:13 Yaniv Gardi
2013-06-27 15:28 ` Chris Ball [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=874ncjpo7z.fsf@octavius.laptop.org \
--to=cjb@laptop.org \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mmc@vger.kernel.org \
--cc=ygardi@codeaurora.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®