Patch "mmc: core: Terminate infinite loop in SD-UHS voltage switch" has been added to the 5.15-stable tree

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

 



This is a note to let you know that I've just added the patch titled

    mmc: core: Terminate infinite loop in SD-UHS voltage switch

to the 5.15-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     mmc-core-terminate-infinite-loop-in-sd-uhs-voltage-s.patch
and it can be found in the queue-5.15 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 922ebc6438d792f40a16c41261b1a2b44615c50a
Author: Brian Norris <briannorris@xxxxxxxxxxxx>
Date:   Tue Sep 13 18:40:10 2022 -0700

    mmc: core: Terminate infinite loop in SD-UHS voltage switch
    
    [ Upstream commit e9233917a7e53980664efbc565888163c0a33c3f ]
    
    This loop intends to retry a max of 10 times, with some implicit
    termination based on the SD_{R,}OCR_S18A bit. Unfortunately, the
    termination condition depends on the value reported by the SD card
    (*rocr), which may or may not correctly reflect what we asked it to do.
    
    Needless to say, it's not wise to rely on the card doing what we expect;
    we should at least terminate the loop regardless. So, check both the
    input and output values, so we ensure we will terminate regardless of
    the SD card behavior.
    
    Note that SDIO learned a similar retry loop in commit 0797e5f1453b
    ("mmc: core: Fixup signal voltage switch"), but that used the 'ocr'
    result, and so the current pre-terminating condition looks like:
    
        rocr & ocr & R4_18V_PRESENT
    
    (i.e., it doesn't have the same bug.)
    
    This addresses a number of crash reports seen on ChromeOS that look
    like the following:
    
        ... // lots of repeated: ...
        <4>[13142.846061] mmc1: Skipping voltage switch
        <4>[13143.406087] mmc1: Skipping voltage switch
        <4>[13143.964724] mmc1: Skipping voltage switch
        <4>[13144.526089] mmc1: Skipping voltage switch
        <4>[13145.086088] mmc1: Skipping voltage switch
        <4>[13145.645941] mmc1: Skipping voltage switch
        <3>[13146.153969] INFO: task halt:30352 blocked for more than 122 seconds.
        ...
    
    Fixes: f2119df6b764 ("mmc: sd: add support for signal voltage switch procedure")
    Cc: <stable@xxxxxxxxxxxxxxx>
    Signed-off-by: Brian Norris <briannorris@xxxxxxxxxxxx>
    Reviewed-by: Guenter Roeck <linux@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20220914014010.2076169-1-briannorris@xxxxxxxxxxxx
    Signed-off-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c
index eaa2679b9466..86a8a1f56583 100644
--- a/drivers/mmc/core/sd.c
+++ b/drivers/mmc/core/sd.c
@@ -863,7 +863,8 @@ int mmc_sd_get_cid(struct mmc_host *host, u32 ocr, u32 *cid, u32 *rocr)
 	 * the CCS bit is set as well. We deliberately deviate from the spec in
 	 * regards to this, which allows UHS-I to be supported for SDSC cards.
 	 */
-	if (!mmc_host_is_spi(host) && rocr && (*rocr & SD_ROCR_S18A)) {
+	if (!mmc_host_is_spi(host) && (ocr & SD_OCR_S18R) &&
+	    rocr && (*rocr & SD_ROCR_S18A)) {
 		err = mmc_set_uhs_voltage(host, pocr);
 		if (err == -EAGAIN) {
 			retries--;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux