clk: devres: fix cleanup in devm_clk_get_optional_enabled_with_rate()
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
clk: devres: fix cleanup in devm_clk_get_optional_enabled_with_rate()
devm_clk_get_optional_enabled_with_rate() registers its cleanup action before setting the clock rate. If setting the rate fails, it attempts to disable and unprepare a clock that was never enabled. This issue was spotted while reviewing "rust: clk: add devres-managed clks" [1].
Register the cleanup action only after successfully preparing and enabling the clock.
[1]: https://lore.kernel.org/rust-for-linux/20260706-clk-type-state-v5-3-67c5f326a16c@collabora.com
From the CVE record · Linux
In the Linux kernel, devm_clk_get_optional_enabled_with_rate() registers a cleanup action before setting the clock rate. If setting the rate fails, cleanup attempts to disable and unprepare a clock that was never enabled. The input does not describe an attacker action or specify network access, authentication, or user-interaction conditions.
Engineers running Linux kernels that use devm_clk_get_optional_enabled_with_rate() should check their kernel versions; affected versions are not specified.