CVE-2024-42100: clk: sunxi-ng: common: Don't call hw_to_ccu_common on hw without common
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
clk: sunxi-ng: common: Don't call hw_to_ccu_common on hw without common
In order to set the rate range of a hw sunxi_ccu_probe calls hw_to_ccu_common() assuming all entries in desc->ccu_clks are contained in a ccu_common struct. This assumption is incorrect and, in consequence, causes invalid pointer de-references.
Remove the faulty call. Instead, add one more loop that iterates over the ccu_clks and sets the rate range, if required.
The Linux kernel CVE team has assigned CVE-2024-42100 to this issue.
Affected and fixed versions
===========================
Issue introduced in 6.6.31 with commit 547263745e15 and fixed in 6.6.39 with commit 14c78d69dbca Issue introduced in 6.9 with commit b914ec33b391 and fixed in 6.9.9 with commit 7a0e2738cb6d Issue introduced in 6.9 with commit b914ec33b391 and fixed in 6.10 with commit ea977d742507 Issue introduced in 6.8.10 with commit 761cbd9c0e4e
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2024-42100
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
drivers/clk/sunxi-ng/ccu_common.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/14c78d69dbca6a28af14095f639ec4318ec07fdc https://git.kernel.org/stable/c/7a0e2738cb6da5a55c9908dff333600aeb263e07 https://git.kernel.org/stable/c/ea977d742507e534d9fe4f4d74256f6b7f589338