[RFC/PATCH]: mmc: card/core: support password locked cards

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi there,

while testing some features of sd cards, i found out, that the linux kernel does not currently support cards properly that are locked by password.
According to the publicly available SD card specification all SD cards seem to support this locking mechanism and i have seen cards in the wild using it.

When using a locked SD card in a linux machine using the mmc layer, probing the card leads to errors because most commands related to the actual storage are unavailable in a locked SD card.

Therefore I propose to add a basic support for locked cards in the kernel. The user space applications might take care of unlocking the card afterwards. When a card has been unlocked it stays unlocked until cycling it, reset commands won't lock it again.

My questions are:
1. Should a card that is locked be visible via /dev/mmcblkX? 
 I think it should be, in order to be able to issue an unlock command.
2. What should read/write operations return on a locked card EPERM, EACCESS or something else?
3. Should locking/unlocking be done via a special ioctl command, as the card needs to be rescanned anyways? 
4. How to cleanly initiate a rescan from userspace if answer to 3 is no? Currently I issue a reset command to the card which forces to kernel to fail issuing CMD13 and therefore reinitialize it, not too nice honestly.

See my proof-of-concept patch attached, it is not meant to be perfect but to show my point.

Best regards,
  Peter

Attachment: mmc_locked.patch
Description: Binary data

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail


[Index of Archives]     [Linux USB Devel]     [Linux Media]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux