Skip to contentSkip to conversation

phy: qcom-qmp-combo: fix NULL-deref on runtime resume

PATCH Applied Johan Hovold 4 participants 4 messages Oct 26, 2022 – Oct 28, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 phy: qcom-qmp-combo: fix NULL-deref on runtime resume

Commit fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate PCS_USB region") started treating the PCS_USB registers as potentially separate from the PCS registers but used the wrong base when no PCS_USB offset has been provided.

Fix the PCS_USB base used at runtime resume to prevent dereferencing a NULL pointer on platforms that do not provide a PCS_USB offset (e.g. SC7180).

Fixes fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate PCS_USB region")
---
 drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +1 -1
index f6328434c61e..ad6a0fd7ba8e 100644
@@ -2144,7 +2144,7 @@ static void qmp_combo_enable_autonomous_mode(struct qmp_phy *qphy)
 static void qmp_combo_disable_autonomous_mode(struct qmp_phy *qphy)
 {
 	const struct qmp_phy_cfg *cfg = qphy->cfg;
-	void __iomem *pcs_usb = qphy->pcs_usb ?: qphy->pcs_usb;
+	void __iomem *pcs_usb = qphy->pcs_usb ?: qphy->pcs;
 	void __iomem *pcs_misc = qphy->pcs_misc;
 
 	/* Disable i/o clamp_n on resume for normal mode */
Signature · 1 line
2.37.3
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Johan Hovold

Commit fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate PCS_USB region") started treating the PCS_USB registers as potentially separate from the PCS registers but used the wrong base when no PCS_USB offset has been provided.

Quoted 7 lines

Fix the PCS_USB base used at runtime resume to prevent dereferencing a NULL pointer on platforms that do not provide a PCS_USB offset (e.g. SC7180).

Fixes fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate PCS_USB region")

For what it is worth, I double checked and phy-qcom-qmp-usb.c has this done properly already.

Thanks,
Andrew

Quoted 20 lines
---
 drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/phy/qualcomm/phy-qcom-qmp-combo.c +1 -1
index f6328434c61e..ad6a0fd7ba8e 100644
@@ -2144,7 +2144,7 @@ static void qmp_combo_enable_autonomous_mode(struct qmp_phy *qphy)
 static void qmp_combo_disable_autonomous_mode(struct qmp_phy *qphy)
 {
 	const struct qmp_phy_cfg *cfg = qphy->cfg;
-	void __iomem *pcs_usb = qphy->pcs_usb ?: qphy->pcs_usb;
+	void __iomem *pcs_usb = qphy->pcs_usb ?: qphy->pcs;
 	void __iomem *pcs_misc = qphy->pcs_misc;
 
 	/* Disable i/o clamp_n on resume for normal mode */
Signature · 1 line
2.37.3
Reviewed-by on v1 1/1
#2 lore raw
In reply to Johan Hovold
Quoted 9 lines · Johan Hovold

Commit fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate PCS_USB region") started treating the PCS_USB registers as potentially separate from the PCS registers but used the wrong base when no PCS_USB offset has been provided.

Fix the PCS_USB base used at runtime resume to prevent dereferencing a NULL pointer on platforms that do not provide a PCS_USB offset (e.g. SC7180).

Quoted 6 lines
Fixes fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate PCS_USB region")
---
  drivers/phy/qualcomm/phy-qcom-qmp-combo.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Signature · 2 lines
With best wishes
Dmitry
maintainer Applied
#3 lore raw
In reply to Johan Hovold
Quoted 8 lines · Johan Hovold

Commit fc64623637da ("phy: qcom-qmp-combo,usb: add support for separate PCS_USB region") started treating the PCS_USB registers as potentially separate from the PCS registers but used the wrong base when no PCS_USB offset has been provided.

Fix the PCS_USB base used at runtime resume to prevent dereferencing a NULL pointer on platforms that do not provide a PCS_USB offset (e.g. SC7180).

Applied, thanks

Signature · 1 line
~Vinod