On 2024-05-20 11:08, Christian Loehle wrote:
On 5/19/24 08:08, linux-mmc@xxxxxxxxx wrote:
------ Tessian Warning ------
Be careful, the email's sending domain "@danman[.]eu" has never been
seen on your company's network before today
This warning message will be removed if you reply to or forward this
email to a recipient outside of your organization.
---- Tessian Warning End ----
From: Daniel Kucera <linux-mmc@xxxxxxxxx>
Implemented locking/unlocking using CMD42 according to Micron
Technical Note
original link
https://media-www.micron.com/-/media/client/global/documents/products/technical-note/sd-cards/tnsd01_enable_sd_lock_unlock_in_linux.pdf?rev=03f03a6bc0f8435fafa93a8fc8e88988
currently available at
https://github.com/danielkucera/esp32-sdcard/blob/master/tnsd01_enable_sd_lock_unlock_in_linux.pdf
You explained it nicely in v1 why this feature is indeed more
dangerous than a simple erase:
https://lore.kernel.org/linux-mmc/DM6PR04MB6575AC22506EDEBB7C7E9310FCE82@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx/T/#m4241fce85459336e2ca4d2abbcccf6d6227e9501
Locking a card will essentially brick it for all practical purposes if
it is removed (or the system shuts down)
between locking and unlocking until mmcblk supports initialization of
locked cards.
I'd upstream that first, I had a similar patch like you mentioned, but
didn't get around to it.
I think this is a chicken-egg problem:
If you don't have the tools to lock you cannot test correct detection
with kernel.
If you don't have kernel supporting locked cards you cannot unlock (but
can lock).
Regarding the potential damage: what can cause a bigger damage? Loosing
data or loosing the medium?
But anyway, I will prepare the kernel patch shortly.
D.