Subject: CVE-2024-27003: clk: Get runtime PM before walking tree for clk_summary

From: Greg Kroah-Hartman <[email-masked]>

Description
===========

In the Linux kernel, the following vulnerability has been resolved:

clk: Get runtime PM before walking tree for clk_summary

Similar to the previous commit, we should make sure that all devices are
runtime resumed before printing the clk_summary through debugfs. Failure
to do so would result in a deadlock if the thread is resuming a device
to print clk state and that device is also runtime resuming in another
thread, e.g the screen is turning on and the display driver is starting
up. We remove the calls to clk_pm_runtime_{get,put}() in this path
because they're superfluous now that we know the devices are runtime
resumed. This also squashes a bug where the return value of
clk_pm_runtime_get() wasn't checked, leading to an RPM count underflow
on error paths.

The Linux kernel CVE team has assigned CVE-2024-27003 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.17 with commit 1bb294a7981c and fixed in 6.1.88 with commit 83ada89e4a86
	Issue introduced in 5.17 with commit 1bb294a7981c and fixed in 6.6.29 with commit 2c077fdfd09d
	Issue introduced in 5.17 with commit 1bb294a7981c and fixed in 6.8.8 with commit b457105309d3
	Issue introduced in 5.17 with commit 1bb294a7981c and fixed in 6.9 with commit 9d1e795f754d

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-27003
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/clk.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/83ada89e4a86e2b28ea2b5113c76d6dc7560a4d0
	https://git.kernel.org/stable/c/2c077fdfd09dffb31a890e5095c8ab205138a42e
	https://git.kernel.org/stable/c/b457105309d388e4081c716cf7b81d517ff74db4
	https://git.kernel.org/stable/c/9d1e795f754db1ac3344528b7af0b17b8146f321