net: phy: allow MDIO bus PM ops to start/stop state machine for phylink-controlled PHY
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
≥ 744d23c71af39c7dc77ac7c3cac87ae86a181a85 · < fc75ea20ffb452652f0d4033f38fe88d7cfdae35| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
net: phy: allow MDIO bus PM ops to start/stop state machine for phylink-controlled PHY
DSA has 2 kinds of drivers:
1. Those who call dsa_switch_suspend() and dsa_switch_resume() from their device PM ops: qca8k-8xxx, bcm_sf2, microchip ksz 2. Those who don't: all others. The above methods should be optional.
For type 1, dsa_switch_suspend() calls dsa_user_suspend() -> phylink_stop(), and dsa_switch_resume() calls dsa_user_resume() -> phylink_start(). These seem good candidates for setting mac_managed_pm = true because that is essentially its definition [1], but that does not seem to be the biggest problem for now, and is not what this change focuses on.
Talking strictly about the 2nd category of DSA drivers here (which do not have MAC managed PM, meaning that for their attached PHYs, mdio_bus_phy_suspend() and mdio_bus_phy_resume() should run in full), I have noticed that the following warning from mdio_bus_phy_resume() is triggered:
WARN_ON(phydev->state != PHY_HALTED && phydev->state != PHY_READY && phydev->state != PHY_UP);
because the PHY state machine is running.
From the CVE record · Linux
The Linux kernel can trigger a warning when resuming a phylink-controlled PHY whose power management is handled by the MDIO bus. The PHY state machine may keep running through suspend, leaving the PHY in an unexpected state on resume. The input does not describe an attacker-controlled path, authentication requirements, or user interaction.
Engineers running Linux kernels with phylink-controlled PHYs and MDIO-bus-managed PHY power management should check their deployments; affected versions are not specified.