mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Hongxing Zhu <hongxing.zhu@nxp.com>
To: Rudi Heitbaum <rudi@heitbaum.com>, Lucas Stach <l.stach@pengutronix.de>
Cc: "Lorenzo Pieralisi" <lpieralisi@kernel.org>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	"Manivannan Sadhasivam" <mani@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	"linux-arm-kernel@lists.infradead.org"
	<linux-arm-kernel@lists.infradead.org>,
	"imx@lists.linux.dev" <imx@lists.linux.dev>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"stable@vger.kernel.org" <stable@vger.kernel.org>
Subject: RE: [PATCH] PCI: imx6: Avoid dereferencing a NULL clock name
Date: Mon, 3 Aug 2026 02:54:52 +0000	[thread overview]
Message-ID: <GV2PR04MB120195449378280CCAF9503328CD52@GV2PR04MB12019.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <am8iBwJSEhYhWTqk@6cfee64030a6>

> -----Original Message-----
> From: Rudi Heitbaum <rudi@heitbaum.com>
> Sent: Sunday, August 2, 2026 6:55 PM
> To: Hongxing Zhu <hongxing.zhu@nxp.com>; Lucas Stach
> <l.stach@pengutronix.de>
> Cc: Lorenzo Pieralisi <lpieralisi@kernel.org>; Krzysztof Wilczyński
> <kwilczynski@kernel.org>; Manivannan Sadhasivam <mani@kernel.org>; Rob
> Herring <robh@kernel.org>; Bjorn Helgaas <bhelgaas@google.com>; linux-
> pci@vger.kernel.org; linux-arm-kernel@lists.infradead.org; imx@lists.linux.dev;
> linux-kernel@vger.kernel.org; stable@vger.kernel.org; rudi@heitbaum.com
> Subject: [PATCH] PCI: imx6: Avoid dereferencing a NULL clock name
> 
> [You don't often get email from rudi@heitbaum.com. Learn why this is important
> at https://aka.ms/LearnAboutSenderIdentification ]
> 
> 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. The extref scan dereferences that id unconditionally, so
> such a node oopses during probe.
> 
> Check clk_bulk_data::id before dereferencing it.
> 
> Fixes: d8574ce57d76 ("PCI: imx6: Add external reference clock input mode
> support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Rudi Heitbaum <rudi@heitbaum.com>
Good catch.
This isn't triggered in my daily tests, but the fix is correct.
Thanks for this fix.
Acked-by: Richard Zhu <hongxing.zhu@nxp.com>

Best Regards
Richard Zhu
> ---
>  drivers/pci/controller/dwc/pci-imx6.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/pci/controller/dwc/pci-imx6.c
> b/drivers/pci/controller/dwc/pci-imx6.c
> index f7389b5437df..dcdeba1856f7 100644
> --- a/drivers/pci/controller/dwc/pci-imx6.c
> +++ b/drivers/pci/controller/dwc/pci-imx6.c
> @@ -1831,7 +1831,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)) {
> --
> 2.53.0


  reply	other threads:[~2026-08-03  2:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-02 10:55 Rudi Heitbaum
2026-08-03  2:54 ` Hongxing Zhu [this message]
2026-09-10  8:24 ` Manivannan Sadhasivam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=GV2PR04MB120195449378280CCAF9503328CD52@GV2PR04MB12019.eurprd04.prod.outlook.com \
    --to=hongxing.zhu@nxp.com \
    --cc=bhelgaas@google.com \
    --cc=imx@lists.linux.dev \
    --cc=kwilczynski@kernel.org \
    --cc=l.stach@pengutronix.de \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=lpieralisi@kernel.org \
    --cc=mani@kernel.org \
    --cc=robh@kernel.org \
    --cc=rudi@heitbaum.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®