Re: [patch 1/5] Add MMC password protection (lock/unlock) supportV3

From: Anderson Briglia
Date: Wed Jan 11 2006 - 08:14:08 EST


Russell King wrote:

>On Mon, Jan 09, 2006 at 06:15:00PM -0400, Anderson Briglia wrote:
>
>
>>When a card is locked, only commands from the "basic" and "lock card" classes
>>are accepted. To be able to use the other commands, the card must be unlocked
>>first.
>>
>>
>
>I don't think this works as you intend.
>
>When a card is initially inserted, we discover the cards via mmc_setup()
>and mmc_discover_cards(). This means that we'll never set the locked
>status for newly inserted cards.
>
>
mmc_setup() calls mmc_check_cards(). Our patch adds the necessary code
to mmc_check_cards() to set the locked state when the card is locked.

>>===================================================================
>>--- linux-2.6.15-rc4.orig/drivers/mmc/mmc.c 2005-12-15 14:06:52.000000000 -0400
>>+++ linux-2.6.15-rc4/drivers/mmc/mmc.c 2005-12-15 17:00:37.000000000 -0400
>>@@ -986,10 +986,15 @@ static void mmc_check_cards(struct mmc_h
>> cmd.flags = MMC_RSP_R1;
>>
>> err = mmc_wait_for_cmd(host, &cmd, CMD_RETRIES);
>>- if (err == MMC_ERR_NONE)
>>+ if (err != MMC_ERR_NONE) {
>>+ mmc_card_set_dead(card);
>> continue;
>>+ }
>>
>>- mmc_card_set_dead(card);
>>+ if (cmd.resp[0] & R1_CARD_IS_LOCKED)
>>+ mmc_card_set_locked(card);
>>+ else
>>+ card->state &= ~MMC_STATE_LOCKED;
>>
>>
Anderson Briglia
INdT - Manaus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/