CVE-2024-53192
kernel: clk: clk-loongson2: Fix potential buffer overflow in flexible-array member access
Severity
ModerateRed Hat Product Security
CVSS 3.1
Review impact separately from score.
Published · December 27, 2024
Updated · October 30, 2026
Description
In the Linux kernel, the following vulnerability has been resolved:
clk: clk-loongson2: Fix potential buffer overflow in flexible-array member access
Flexible-array member hws in struct clk_hw_onecell_data is annotated
with the counted_by() attribute. This means that when memory is
allocated for this array, the counter, which in this case is member
num in the flexible structure, should be set to the maximum number of
elements the flexible array can contain, or fewer.
In this case, the total number of elements for the flexible array is
determined by variable clks_num when allocating heap space via
devm_kzalloc(), as shown below:
289 struct loongson2_clk_provider *clp; ... 296 for (p = data; p->name; p++) 297 clks_num++; 298 299 clp = devm_kzalloc(dev, struct_size(clp, clk_data.hws, clks_num), 300 GFP_KERNEL);
So, clp->clk_data.num should be set to clks_num or less, and not
exceed clks_num, as is currently the case. Otherwise, if data is
written into clp->clk_data.hws[clks_num], the instrumentation
provided by the compiler won't detect the overflow, leading to a
memory corruption bug at runtime.
Fix this issue by setting clp->clk_data.num to clks_num.
Statement
Red Hat has evaluated this vulnerability as having a Moderate severity impact because exploitation is constrained to local environments and requires specialized Loongson hardware architectures. The issue exists within the Loongson-2 clock provider driver, which is only initialized during hardware setup on relevant platforms. Standard Red Hat Enterprise Linux releases do not support or run on this hardware architecture, meaning enterprise environments are not exposed under default configurations.
CVSS score applicability
The CVSS score(s) listed for this vulnerability do not reflect the associated product's status, and are included for informational purposes to better understand the severity of this vulnerability.
Mitigation
No mitigation is specified in collected source.
CVSS / CWE
CVSS 3.1 · 7.8CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
CWE-193 · Off-by-one Error