FAILED: patch "[PATCH] PCI: imx6: Avoid dereferencing a NULL clock name" failed to apply to 6.18-stable tree
Subsystems (5)
Sasha Levin
maintainerThe patch below does not apply to the 6.18-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.18.y
git checkout FETCH_HEAD
git cherry-pick -x e60d0d4dfddfac3058753a1c2255251401c92dad
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Thanks,
Sasha
------------------ original commit in Linus's tree ------------------
From e60d0d4dfddfac3058753a1c2255251401c92dad Mon Sep 17 00:00:00 2001
From: Rudi Heitbaum <[email protected]>
Date: Mon, 14 Sep 2026 12:35:31 +0000
Subject: [PATCH] PCI: imx6: Avoid dereferencing a NULL clock name
of_clk_bulk_get() leaves 'clk_bulk_data->id' as NULL for every clock that has no matching entry in "clock-names", which is legal: a node may list more "clocks" phandles than it names. Both scans of the bulk array dereference that id unconditionally, so such a node oopses during probe.
The loop in imx_pcie_probe() has been wrong since it was written. The loop in imx_setup_phy_mpll() was not: it read a fixed clks[] whose ids came from the driver's own clk_names[] and were never NULL, and only became wrong when the driver moved to the bulk array.
Check 'clk_bulk_data->id' before dereferencing it in both.
--- drivers/pci/controller/dwc/pci-imx6.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/pci/controller/dwc/pci-imx6.c +3 -2
@@ -584,7 +584,7 @@ static int imx_setup_phy_mpll(struct imx_pcie *imx_pcie)return 0 ;for (i =0 ; i < imx_pcie->num_clks; i++) -if (strncmp (clks[i].id,"pcie_phy" ,8 ) ==0 ) +if (clks[i].id &&strncmp (clks[i].id,"pcie_phy" ,8 ) ==0 ) phy_rate =clk_get_rate (clks[i].clk);switch (phy_rate) {
@@ -1902,7 +1902,8 @@ static int imx_pcie_probe(struct platform_device *pdev)return dev_err_probe (dev, imx_pcie->num_clks,"failed to get clocks\n" );for (i =0 ; i < imx_pcie->num_clks; i++) -if (strncmp (imx_pcie->clks[i].id,"extref" ,6 ) ==0 ) +if (imx_pcie->clks[i].id && +strncmp (imx_pcie->clks[i].id,"extref" ,6 ) ==0 ) imx_pcie->enable_ext_refclk = true;if (imx_check_flag (imx_pcie,IMX_PCIE_FLAG_HAS_PHYDRV )) {
Signature · 1 line
2.53.0
Sasha Levin
maintainerPATCH 1/1 PCI: imx6: Avoid dereferencing a NULL clock name
From: Rudi Heitbaum <[email protected]>
[ Upstream commit e60d0d4dfddfac3058753a1c2255251401c92dad ]
of_clk_bulk_get() leaves 'clk_bulk_data->id' as NULL for every clock that has no matching entry in "clock-names", which is legal: a node may list more "clocks" phandles than it names. Both scans of the bulk array dereference that id unconditionally, so such a node oopses during probe.
The loop in imx_pcie_probe() has been wrong since it was written. The loop in imx_setup_phy_mpll() was not: it read a fixed clks[] whose ids came from the driver's own clk_names[] and were never NULL, and only became wrong when the driver moved to the bulk array.
Check 'clk_bulk_data->id' before dereferencing it in both.
--- drivers/pci/controller/dwc/pci-imx6.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/pci/controller/dwc/pci-imx6.c +1 -1
@@ -540,7 +540,7 @@ static int imx_setup_phy_mpll(struct imx_pcie *imx_pcie)return 0 ;for (i =0 ; i < imx_pcie->num_clks; i++) -if (strncmp (clks[i].id,"pcie_phy" ,8 ) ==0 ) +if (clks[i].id &&strncmp (clks[i].id,"pcie_phy" ,8 ) ==0 ) phy_rate =clk_get_rate (clks[i].clk);switch (phy_rate) {
Signature · 1 line
2.53.0