mmc: via-sdmmc: Fix data race bug
authorMadhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
Sat, 22 Aug 2020 06:15:28 +0000 (11:45 +0530)
committerUlf Hansson <ulf.hansson@linaro.org>
Mon, 7 Sep 2020 07:11:29 +0000 (09:11 +0200)
commit87d7ad089b318b4f319bf57f1daa64eb6d1d10ad
tree00d9df7295a106e8cb9c5cfe1e08f3af6837cc29
parent6932794192f63c5e105eade19fba26b8ef29ec79
mmc: via-sdmmc: Fix data race bug

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@gmail.com>
Link: https://lore.kernel.org/r/20200822061528.7035-1-madhuparnabhowmik10@gmail.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/via-sdmmc.c