Re: [PATCH] mmc: block: Differentiate busy and non-TRAN state

From: Christian Löhle
Date: Wed Jul 07 2021 - 05:01:10 EST


Hey Avri,

>Are you using mmc-utils?
No, Im accessing the ioctl interface with my own application.

>Can you share exactly the sequence of commands you are sending?

The one I initially encountered was, as stated earlier, a Unlock-Force Erase
into a new Lock with set password. Basically any R1 (no b) command that
transitions to PROG, so behaves like a write command, could trigger this.
But obviously Unlock force erase is the best example, as a full erase will
take quite some time and many (all?) cards will not accept new commands
(i.e. stay in PROG) until the erase has actually completed. The current
code will not check anything for CMD42 after the response.
I have not hit the race condition with anything but CMD42.

So to be verbose:
CMD16 - CMD42 Set PW - (CMD16)* - CMD42 Unlock Force Erase - (CMD42 Set PW)+
* May be omitted if you craft the CMD42 carefully (i.e. equal data size)
+ is pretty much irrelevant, can be replaced with anything that is illegal in PROG.

>Again, can you share the sequence of the commands you are using?
>
>Thanks,
>Avri
Hyperstone GmbH | Line-Eid-Strasse 3 | 78467 Konstanz
Managing Directors: Dr. Jan Peter Berns.
Commercial register of local courts: Freiburg HRB381782