Patch "mmc: via-sdmmc: Fix data race bug" has been added to the 5.9-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: via-sdmmc: Fix data race bug

to the 5.9-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-via-sdmmc-fix-data-race-bug.patch
and it can be found in the queue-5.9 subdirectory.

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



commit 572eaabac066d032fd59a16a980b2c86cc7c643c
Author: Madhuparna Bhowmik <madhuparnabhowmik10@xxxxxxxxx>
Date:   Sat Aug 22 11:45:28 2020 +0530

    mmc: via-sdmmc: Fix data race bug
    
    [ Upstream commit 87d7ad089b318b4f319bf57f1daa64eb6d1d10ad ]
    
    via_save_pcictrlreg() should be called with host->lock held
    as it writes to pm_pcictrl_reg, otherwise there can be a race
    condition between via_sd_suspend() and via_sdc_card_detect().
    The same pattern is used in the function via_reset_pcictrl()
    as well, where via_save_pcictrlreg() is called with host->lock
    held.
    
    Found by Linux Driver Verification project (linuxtesting.org).
    
    Signed-off-by: Madhuparna Bhowmik <madhuparnabhowmik10@xxxxxxxxx>
    Link: https://lore.kernel.org/r/20200822061528.7035-1-madhuparnabhowmik10@xxxxxxxxx
    Signed-off-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/mmc/host/via-sdmmc.c b/drivers/mmc/host/via-sdmmc.c
index 49dab9f42b6d6..9b755ea0fa03c 100644
--- a/drivers/mmc/host/via-sdmmc.c
+++ b/drivers/mmc/host/via-sdmmc.c
@@ -1257,11 +1257,14 @@ static void __maybe_unused via_init_sdc_pm(struct via_crdr_mmc_host *host)
 static int __maybe_unused via_sd_suspend(struct device *dev)
 {
 	struct via_crdr_mmc_host *host;
+	unsigned long flags;
 
 	host = dev_get_drvdata(dev);
 
+	spin_lock_irqsave(&host->lock, flags);
 	via_save_pcictrlreg(host);
 	via_save_sdcreg(host);
+	spin_unlock_irqrestore(&host->lock, flags);
 
 	device_wakeup_enable(dev);
 



[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