[PATCH V3 6/7] mmc: lock: Prevent block device from coming up for locked cards.

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

 



A locked card will return an error for all reads/writes to the
block device, so prevent the block layer from coming up until
the card is unlocked.

Signed-off-by: Al Cooper <alcooperx@xxxxxxxxx>
---
 drivers/mmc/card/block.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c
index 7b5424f..a4b909d 100644
--- a/drivers/mmc/card/block.c
+++ b/drivers/mmc/card/block.c
@@ -2377,6 +2377,16 @@ static int mmc_blk_probe(struct mmc_card *card)
 	struct mmc_blk_data *md, *part_md;
 	char cap_str[10];
 
+
+	/* if the card is locked, don't bring up the block layer because
+	 * all reads and writes will fail.
+	 */
+	if (mmc_card_locked(card)) {
+		pr_debug("%s: %s - Probe aborted because card is locked\n",
+			 mmc_hostname(card->host), __func__);
+		return -ENODEV;
+	}
+
 	/*
 	 * Check that the card supports the command class(es) we need.
 	 */
-- 
1.8.1.3

--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




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

  Powered by Linux