{"id":"CVE-2024-53193","published":"2024-12-27T13:49:35Z","modified":"2026-08-05T11:44:33Z","title":"clk: clk-loongson2: Fix memory corruption bug in struct loongson2_clk_provider","vendor":"Linux","product":"Linux","tier":"tail","description":{"text":"In the Linux kernel, the following vulnerability has been resolved:\n\nclk: clk-loongson2: Fix memory corruption bug in struct loongson2_clk_provider\n\nSome heap space is allocated for the flexible structure `struct\nclk_hw_onecell_data` and its flexible-array member `hws` through\nthe composite structure `struct loongson2_clk_provider` in function\n`loongson2_clk_probe()`, as shown below:\n\n289         struct loongson2_clk_provider *clp;\n\t...\n296         for (p = data; p->name; p++)\n297                 clks_num++;\n298\n299         clp = devm_kzalloc(dev, struct_size(clp, clk_data.hws, clks_num),\n300                            GFP_KERNEL);\n\nThen some data is written into the flexible array:\n\n350                 clp->clk_data.hws[p->id] = hw;\n\nThis corrupts `clk_lock`, which is the spinlock variable immediately\nfollowing the `clk_data` member in `struct loongson2_clk_provider`:\n\nstruct loongson2_clk_provider {\n\tvoid __iomem *base;\n\tstruct device *dev;\n\tstruct clk_hw_onecell_data clk_data;\n\tspinlock_t clk_lock;\t/* protect access to DIV registers */\n};\n\nThe problem is that the flexible structure is currently placed in the\nmiddle of `struct loongson2_clk_provider` instead of at the end.\n\nFix this by moving `struct clk_hw_onecell_data clk_data;` to the end of\n`struct loongson2_clk_provider`. Also, add a code comment to help\nprevent this from happening again in case new members are added to the\nstructure in the future.\n\nThis change also fixes the following -Wflex-array-member-not-at-end\nwarning:\n\ndrivers/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]","provenance":"source","from":"CVE.org"},"cvss":{"score":7.8,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00226,"percentile":0.13643,"provenance":"source"},"cwes":[{"id":"CWE-787","name":"Out-of-bounds Write"}],"references":[{"url":"https://git.kernel.org/stable/c/76918202615f2ba7deda14901d9fff528a180099","tags":[]},{"url":"https://git.kernel.org/stable/c/145de18065b9840687d9b4e63746238c1da25d22","tags":[]},{"url":"https://git.kernel.org/stable/c/6e4bf018bb040955da53dae9f8628ef8fcec2dbe","tags":[]}],"priority":{"score":8.2,"factors":[{"name":"EPSS percentile","points":2.73},{"name":"CVSS severity","points":5.46}]},"vendorSlug":"linux","affectedVersions":[{"vendor":"Linux","product":"Linux","versions":[">= 9796ec0bd04bb0e70487127d44949ca0554df5d3, < 76918202615f2ba7deda14901d9fff528a180099",">= 9796ec0bd04bb0e70487127d44949ca0554df5d3, < 145de18065b9840687d9b4e63746238c1da25d22",">= 9796ec0bd04bb0e70487127d44949ca0554df5d3, < 6e4bf018bb040955da53dae9f8628ef8fcec2dbe"]},{"vendor":"Linux","product":"Linux","versions":["6.10"]}],"ssvc":{"exploitation":"none","automatable":"no","technicalImpact":"total","timestamp":"2025-10-01T20:04:04.188198Z","from":"CISA ADP","provenance":"source"},"euvd":{"id":"EUVD-2024-51865","exploited":false,"provenance":"source"}}