In the Linux kernel, the following vulnerability has been resolved:
clk: clk-loongson2: Fix memory corruption bug in struct loongson2_clk_provider
Some heap space is allocated for the flexible structure `struct clk_hw_onecell_data` and its flexible-array member `hws` through the composite structure `struct loongson2_clk_provider` in function `loongson2_clk_probe()`, 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);
Then some data is written into the flexible array:
350 clp->clk_data.hws[p->id] = hw;
This corrupts `clk_lock`, which is the spinlock variable immediately following the `clk_data` member in `struct loongson2_clk_provider`:
struct loongson2_clk_provider { void __iomem *base; struct device *dev; struct clk_hw_onecell_data clk_data; spinlock_t clk_lock; /* protect access to DIV registers */ };
The problem is that the flexible structure is currently placed in the middle of `struct loongson2_clk_provider` instead of at the end.
Fix this by moving `struct clk_hw_onecell_data clk_data;` to the end of `struct loongson2_clk_provider`. Also, add a code comment to help prevent this from happening again in case new members are added to the structure in the future.
This change also fixes the following -Wflex-array-member-not-at-end warning:
drivers/clk/clk-loongson2.c:32:36: warning: structure containing a flexible array member is not at the end of another structure [-Wflex-array-member-not-at-end]
CVSS Details
- CVSS 3.1 Base Score: 7.8
- CVSS 3.1 Vector: (CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H)
Covered by Rapid7
| Product | Vendor Advisory | Solution File | Added | Published |
|---|---|---|---|---|
| Debian | — | Upgrade linux | Jul 27, 2026 | Jul 27, 2026 |
| Ubuntu | — | Upgrade linux-image-6.11.0-1009-azure-fdeUpgrade linux-image-generic-hwe-24.04Upgrade linux-image-6.11.0-18-generic-64kUpgrade linux-image-virtualUpgrade linux-image-gcpUpgrade linux-image-6.11.0-1011-oracleUpgrade linux-image-virtual-hwe-24.04Upgrade linux-image-6.11.0-18-genericUpgrade linux-image-realtime-hwe-24.04Upgrade linux-image-oem-24.04aUpgrade linux-image-6.11.0-1011-oracle-64kUpgrade linux-image-generic-64kUpgrade linux-image-6.11.0-1015-oemUpgrade linux-image-genericUpgrade linux-image-oem-24.04Upgrade linux-image-6.11.0-1005-realtimeUpgrade linux-image-6.11.0-1010-lowlatencyUpgrade linux-image-oracle-64kUpgrade linux-image-raspiUpgrade linux-image-generic-64k-hwe-24.04Upgrade linux-image-6.11.0-1010-lowlatency-64kUpgrade linux-image-lowlatencyUpgrade linux-image-6.11.0-1008-raspiUpgrade linux-image-oem-24.04bUpgrade linux-image-6.11.0-1009-azureUpgrade linux-image-6.11.0-1009-gcpUpgrade linux-image-azureUpgrade linux-image-awsUpgrade linux-image-realtimeUpgrade linux-image-oracleUpgrade linux-image-6.11.0-1009-awsUpgrade linux-image-lowlatency-64kUpgrade linux-image-azure-fde | Feb 20, 2025 | Dec 27, 2024 |
Prioritise with Active Threat Intelligence
With curated Threat Intelligence, you can see which vulnerabilities truly put you at risk, prioritize what matters most, and act before attackers do.
Explore Intelligence Hub