diff --git a/patches.suse/spi-cadence-qspi-fix-pointer-reference-in-runtime-PM-hooks.patch b/patches.suse/spi-cadence-qspi-fix-pointer-reference-in-runtime-PM-hooks.patch new file mode 100644 index 0000000..62ab156 --- /dev/null +++ b/patches.suse/spi-cadence-qspi-fix-pointer-reference-in-runtime-PM-hooks.patch @@ -0,0 +1,79 @@ +From: =?utf-8?q?Th=C3=A9o_Lebrun_=3Ctheo=2Elebrun=40bootlin=2Ecom=3E?= +Date: Thu, 22 Feb 2024 11:12:29 +0100 +Subject: spi: cadence-qspi: fix pointer reference in runtime PM hooks +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit +Git-commit: 32ce3bb57b6b402de2aec1012511e7ac4e7449dc +Patch-mainline: v6.8-rc7 +References: CVE-2024-26807 bsc#1222801 + +dev_get_drvdata() gets used to acquire the pointer to cqspi and the SPI +controller. Neither embed the other; this lead to memory corruption. + +On a given platform (Mobileye EyeQ5) the memory corruption is hidden +inside cqspi->f_pdata. Also, this uninitialised memory is used as a +mutex (ctlr->bus_lock_mutex) by spi_controller_suspend(). + +Fixes: 2087e85bb66e ("spi: cadence-quadspi: fix suspend-resume implementations") +Reviewed-by: Dhruva Gole +Signed-off-by: Théo Lebrun +Link: https://msgid.link/r/20240222-cdns-qspi-pm-fix-v4-1-6b6af8bcbf59@bootlin.com +Signed-off-by: Mark Brown +[iivanov: Adapt the fix for SLE15-SP5 without kABI breakage" +Acked-by: Ivan T. Ivanov +--- + drivers/spi/spi-cadence-quadspi.c | 19 +++++++++++++++++-- + 1 file changed, 17 insertions(+), 2 deletions(-) + +--- a/drivers/spi/spi-cadence-quadspi.c ++++ b/drivers/spi/spi-cadence-quadspi.c +@@ -1446,6 +1446,13 @@ static int cqspi_probe(struct platform_d + master->mem_ops = &cqspi_mem_ops; + master->dev.of_node = pdev->dev.of_node; + ++ /* ++ * hack: Fix bsc#1222801 CVE-2024-26807 ++ * Upstream commit 32ce3bb57b6b402de2aec1012511e7ac4e7449dc ++ * Reuse this unused member to keep SPI host reference ++ */ ++ pdev->mfd_cell = (struct mfd_cell *) master; ++ + cqspi = spi_master_get_devdata(master); + + cqspi->pdev = pdev; +@@ -1592,6 +1599,9 @@ static int cqspi_remove(struct platform_ + { + struct cqspi_st *cqspi = platform_get_drvdata(pdev); + ++ /* hack: Fix bsc#1222801 CVE-2024-26807 */ ++ cqspi->pdev->mfd_cell = NULL; ++ + cqspi_controller_enable(cqspi, 0); + + if (cqspi->rx_chan) +@@ -1609,9 +1619,11 @@ static int cqspi_remove(struct platform_ + static int cqspi_suspend(struct device *dev) + { + struct cqspi_st *cqspi = dev_get_drvdata(dev); +- struct spi_master *master = dev_get_drvdata(dev); ++ struct spi_master *master; + int ret; + ++ /* hack: Fix bsc#1222801 CVE-2024-26807 */ ++ master = (struct spi_master *) cqspi->pdev->mfd_cell; + ret = spi_master_suspend(master); + cqspi_controller_enable(cqspi, 0); + +@@ -1623,7 +1635,10 @@ static int cqspi_suspend(struct device * + static int cqspi_resume(struct device *dev) + { + struct cqspi_st *cqspi = dev_get_drvdata(dev); +- struct spi_master *master = dev_get_drvdata(dev); ++ struct spi_master *master; ++ ++ /* hack: Fix bsc#1222801 CVE-2024-26807 */ ++ master = (struct spi_master *) cqspi->pdev->mfd_cell; + + clk_prepare_enable(cqspi->clk); + cqspi_wait_idle(cqspi); diff --git a/series.conf b/series.conf index 8c455d4..cedd31d 100644 --- a/series.conf +++ b/series.conf @@ -45788,6 +45788,7 @@ patches.suse/usb-dwc3-gadget-Don-t-disconnect-if-not-started.patch patches.suse/usb-gadget-ncm-Avoid-dropping-datagrams-of-properly-.patch patches.suse/mtd-spinand-gigadevice-Fix-the-get-ecc-status-issue.patch + patches.suse/spi-cadence-qspi-fix-pointer-reference-in-runtime-PM-hooks.patch patches.suse/lan78xx-enable-auto-speed-configuration-for-LAN7850-.patch patches.suse/net-usb-dm9601-fix-wrong-return-value-in-dm9601_mdio.patch patches.suse/wifi-nl80211-reject-iftype-change-with-mesh-ID-chang.patch