CVE-2025-39728: clk: samsung: Fix UBSAN panic in samsung_clk_init()
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
clk: samsung: Fix UBSAN panic in samsung_clk_init()
With UBSAN_ARRAY_BOUNDS=y, I'm hitting the below panic due to dereferencing ctx->clk_data.hws before setting ctx->clk_data.num = nr_clks. Move that up to fix the crash.
UBSAN: array index out of bounds: 00000000f2005512 [#1] PREEMPT SMP <snip> Call trace: samsung_clk_init+0x110/0x124 (P) samsung_clk_init+0x48/0x124 (L) samsung_cmu_register_one+0x3c/0xa0 exynos_arm64_register_cmu+0x54/0x64 __gs101_cmu_top_of_clk_init_declare+0x28/0x60 ...
The Linux kernel CVE team has assigned CVE-2025-39728 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.5 with commit e620a1e061c4738e26c3edf2abaae7842532cd80 and fixed in 5.10.236 with commit 00307934eb94aaa0a99addfb37b9fe206f945004 Issue introduced in 5.5 with commit e620a1e061c4738e26c3edf2abaae7842532cd80 and fixed in 5.15.180 with commit d974e177369c034984cece9d7d4fada9f8b9c740 Issue introduced in 5.5 with commit e620a1e061c4738e26c3edf2abaae7842532cd80 and fixed in 6.1.134 with commit 0fef48f4a70e45a93e73c39023c3a6ea624714d6 Issue introduced in 5.5 with commit e620a1e061c4738e26c3edf2abaae7842532cd80 and fixed in 6.6.87 with commit 4d29a6dcb51e346595a15b49693eeb728925ca43 Issue introduced in 5.5 with commit e620a1e061c4738e26c3edf2abaae7842532cd80 and fixed in 6.12.23 with commit 24307866e0ac0a5ddb462e766ceda5e27a6fbbe3 Issue introduced in 5.5 with commit e620a1e061c4738e26c3edf2abaae7842532cd80 and fixed in 6.13.11 with commit a1500b98cd81a32fdfb9bc63c33bb9f0c2a0a1bf Issue introduced in 5.5 with commit e620a1e061c4738e26c3edf2abaae7842532cd80 and fixed in 6.14.2 with commit 157de9e48007a20c65d02fc0229a16f38134a72d Issue introduced in 5.5 with commit e620a1e061c4738e26c3edf2abaae7842532cd80 and fixed in 6.15-rc1 with commit d19d7345a7bcdb083b65568a11b11adffe0687af
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-2025-39728
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/samsung/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/00307934eb94aaa0a99addfb37b9fe206f945004 https://git.kernel.org/stable/c/d974e177369c034984cece9d7d4fada9f8b9c740 https://git.kernel.org/stable/c/0fef48f4a70e45a93e73c39023c3a6ea624714d6 https://git.kernel.org/stable/c/4d29a6dcb51e346595a15b49693eeb728925ca43 https://git.kernel.org/stable/c/24307866e0ac0a5ddb462e766ceda5e27a6fbbe3 https://git.kernel.org/stable/c/a1500b98cd81a32fdfb9bc63c33bb9f0c2a0a1bf https://git.kernel.org/stable/c/157de9e48007a20c65d02fc0229a16f38134a72d https://git.kernel.org/stable/c/d19d7345a7bcdb083b65568a11b11adffe0687af