]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
phy: freescale: imx8qm-hsio: fix NULL pointer dereference
authorThomas Richard <thomas.richard@bootlin.com>
Wed, 14 Jan 2026 16:50:23 +0000 (17:50 +0100)
committerVinod Koul <vkoul@kernel.org>
Wed, 21 Jan 2026 08:14:46 +0000 (13:44 +0530)
During the probe the refclk_pad pointer is set to NULL if the
'fsl,refclk-pad-mode' property is not defined in the devicetree node. But
in imx_hsio_configure_clk_pad() this pointer is unconditionally used which
could result in a NULL pointer dereference. So check the pointer before to
use it.

Fixes: 82c56b6dd24f ("phy: freescale: imx8qm-hsio: Add i.MX8QM HSIO PHY driver support")
Signed-off-by: Thomas Richard <thomas.richard@bootlin.com>
Reviewed-by: Richard Zhu <hongxing.zhu@nxp.com>
Link: https://patch.msgid.link/20260114-phy-fsl-imx8qm-hsio-fix-null-pointer-dereference-v1-1-730e941be464@bootlin.com
Signed-off-by: Vinod Koul <vkoul@kernel.org>
drivers/phy/freescale/phy-fsl-imx8qm-hsio.c

index 977d21d753a59aa973cef437fbd2c481f60faedd..279b8ac7822df7f5273002f363018556ead23572 100644 (file)
@@ -251,7 +251,7 @@ static void imx_hsio_configure_clk_pad(struct phy *phy)
        struct imx_hsio_lane *lane = phy_get_drvdata(phy);
        struct imx_hsio_priv *priv = lane->priv;
 
-       if (strncmp(priv->refclk_pad, "output", 6) == 0) {
+       if (priv->refclk_pad && strncmp(priv->refclk_pad, "output", 6) == 0) {
                pll = true;
                regmap_update_bits(priv->misc, HSIO_CTRL0,
                                   HSIO_IOB_A_0_TXOE | HSIO_IOB_A_0_M1M0_MASK,