Commit c45c6070 authored by Mantas Pucka's avatar Mantas Pucka Committed by Cai Xinchen
Browse files

mmc: sdhci-msm: pervent access to suspended controller

mainline inclusion
from mainline-v6.9-rc6
commit f8def10f73a516b771051a2f70f2f0446902cb4f
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9TMCJ
CVE: CVE-2024-36029

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f8def10f73a516b771051a2f70f2f0446902cb4f



--------------------------------

Generic sdhci code registers LED device and uses host->runtime_suspended
flag to protect access to it. The sdhci-msm driver doesn't set this flag,
which causes a crash when LED is accessed while controller is runtime
suspended. Fix this by setting the flag correctly.

Cc: stable@vger.kernel.org
Fixes: 67e6db11 ("mmc: sdhci-msm: Add pm_runtime and system PM support")
Signed-off-by: default avatarMantas Pucka <mantas@8devices.com>
Acked-by: default avatarAdrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20240321-sdhci-mmc-suspend-v1-1-fbc555a64400@8devices.com


Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
Conflicts:
	drivers/mmc/host/sdhci-msm.c
[Because commit 0472f8d3 and commit c7eed31e not merged, fix context conflicts and add ret to clk_bulk_prepare_enable.]
Signed-off-by: default avatarCai Xinchen <caixinchen1@huawei.com>
parent 6908dfce
Loading
Loading
Loading
Loading
+16 −1
Original line number Diff line number Diff line
@@ -1970,6 +1970,11 @@ static int sdhci_msm_runtime_suspend(struct device *dev)
	struct sdhci_host *host = dev_get_drvdata(dev);
	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
	struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
	unsigned long flags;

	spin_lock_irqsave(&host->lock, flags);
	host->runtime_suspended = true;
	spin_unlock_irqrestore(&host->lock, flags);

	clk_bulk_disable_unprepare(ARRAY_SIZE(msm_host->bulk_clks),
				   msm_host->bulk_clks);
@@ -1982,9 +1987,19 @@ static int sdhci_msm_runtime_resume(struct device *dev)
	struct sdhci_host *host = dev_get_drvdata(dev);
	struct sdhci_pltfm_host *pltfm_host = sdhci_priv(host);
	struct sdhci_msm_host *msm_host = sdhci_pltfm_priv(pltfm_host);
	unsigned long flags;
	int ret;

	return clk_bulk_prepare_enable(ARRAY_SIZE(msm_host->bulk_clks),
	ret = clk_bulk_prepare_enable(ARRAY_SIZE(msm_host->bulk_clks),
				       msm_host->bulk_clks);
	if (ret)
		return ret;

	spin_lock_irqsave(&host->lock, flags);
	host->runtime_suspended = false;
	spin_unlock_irqrestore(&host->lock, flags);

	return ret;
}
#endif