{"id":"CVE-2024-53193","state":"PUBLISHED","title":"clk: clk-loongson2: Fix memory corruption bug in struct loongson2_clk_provider","description":"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]","publishedAt":"2024-12-27T13:49:35.566Z","updatedAt":"2026-08-05T11:44:33.733Z","severity":{"score":7.8,"label":"High","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","source":"Linux"},"assigner":"Linux","products":["Linux Linux"],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"9796ec0bd04bb0e70487127d44949ca0554df5d3","status":"affected","lessThan":"76918202615f2ba7deda14901d9fff528a180099","versionType":"git"},{"version":"9796ec0bd04bb0e70487127d44949ca0554df5d3","status":"affected","lessThan":"145de18065b9840687d9b4e63746238c1da25d22","versionType":"git"},{"version":"9796ec0bd04bb0e70487127d44949ca0554df5d3","status":"affected","lessThan":"6e4bf018bb040955da53dae9f8628ef8fcec2dbe","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/clk/clk-loongson2.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.10","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.10","versionType":"semver"},{"version":"6.11.11","status":"unaffected","lessThanOrEqual":"6.11.*","versionType":"semver"},{"version":"6.12.2","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.13","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/clk/clk-loongson2.c"]}],"references":["https://git.kernel.org/stable/c/76918202615f2ba7deda14901d9fff528a180099","https://git.kernel.org/stable/c/145de18065b9840687d9b4e63746238c1da25d22","https://git.kernel.org/stable/c/6e4bf018bb040955da53dae9f8628ef8fcec2dbe"],"weaknesses":["CWE-787"],"ingestedAt":"2026-10-29T20:08:04.920Z","source":{"repository":"CVEProject/cvelistV5","path":"cves/2024/53xxx/CVE-2024-53193.json","commit":"556c9d3a8cd17e218bb8e452ba7cd619a384ff47"},"raw":{"dataType":"CVE_RECORD","dataVersion":"5.2","cveMetadata":{"cveId":"CVE-2024-53193","state":"PUBLISHED","datePublished":"2024-12-27T13:49:35.566Z","dateUpdated":"2026-08-05T11:44:33.733Z","assignerShortName":"Linux","assignerOrgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateReserved":"2024-11-19T17:17:25.014Z"},"containers":{"cna":{"title":"clk: clk-loongson2: Fix memory corruption bug in struct loongson2_clk_provider","descriptions":[{"lang":"en","value":"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]"}],"affected":[{"vendor":"Linux","product":"Linux","defaultStatus":"unaffected","versions":[{"version":"9796ec0bd04bb0e70487127d44949ca0554df5d3","status":"affected","lessThan":"76918202615f2ba7deda14901d9fff528a180099","versionType":"git"},{"version":"9796ec0bd04bb0e70487127d44949ca0554df5d3","status":"affected","lessThan":"145de18065b9840687d9b4e63746238c1da25d22","versionType":"git"},{"version":"9796ec0bd04bb0e70487127d44949ca0554df5d3","status":"affected","lessThan":"6e4bf018bb040955da53dae9f8628ef8fcec2dbe","versionType":"git"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/clk/clk-loongson2.c"]},{"vendor":"Linux","product":"Linux","defaultStatus":"affected","versions":[{"version":"6.10","status":"affected"},{"version":"0","status":"unaffected","lessThan":"6.10","versionType":"semver"},{"version":"6.11.11","status":"unaffected","lessThanOrEqual":"6.11.*","versionType":"semver"},{"version":"6.12.2","status":"unaffected","lessThanOrEqual":"6.12.*","versionType":"semver"},{"version":"6.13","status":"unaffected","lessThanOrEqual":"*","versionType":"original_commit_for_fix"}],"repo":"https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git","programFiles":["drivers/clk/clk-loongson2.c"]}],"references":[{"url":"https://git.kernel.org/stable/c/76918202615f2ba7deda14901d9fff528a180099"},{"url":"https://git.kernel.org/stable/c/145de18065b9840687d9b4e63746238c1da25d22"},{"url":"https://git.kernel.org/stable/c/6e4bf018bb040955da53dae9f8628ef8fcec2dbe"}],"metrics":[{"cvssV3_1":{"version":"3.1","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","baseScore":7.8,"baseSeverity":"HIGH"},"scenarios":[{"lang":"en","value":"AV:L - The flaw is in a SoC platform clock-controller driver bound from device tree; there is no network or adjacent-network path, and the corrupted lock is only exercised through local clock consumers (DRM modeset ioctl, cpufreq, gate enable) on the affected Loongson-2K board.\nAC:L - The overlap between `clk_data.hws[]` and `clk_lock` is a deterministic consequence of the struct layout and occurs on every boot of an affected board with no race to win and no memory-layout grooming required; reaching the corrupted lock afterwards is a normal, repeatable operation.\nPR:L - The corruption itself is established at boot with no privileges at all, and an ordinary unprivileged local user can then drive code that acquires the clobbered spinlock (e.g. a modeset on the display controller's pix0/pix1 divider clocks via /dev/dri/card*), so no administrative capability is needed.\nUI:N - The memory corruption happens automatically during driver probe at boot, and triggering its effect requires only the attacker's own actions — no victim must open a file, mount a filesystem, or otherwise cooperate.\nS:U - Both the corrupted memory and the resulting impact are entirely within the kernel's own security authority; no VM, IOMMU, or sandbox boundary is crossed.\nC:H - Kernel heap pointers (`struct clk_hw *`) are written into the spinlock's debug/lockdep fields where they are leaked to dmesg via spin_dump()/lockdep splats, and conversely the raw lock bytes are returned to consumers as a `struct clk_hw *` through `of_clk_hw_onecell_get()` index 0, giving a type-confused pointer the clk core dereferences for reads.\nI:H - This is a genuine memory-corruption primitive in both directions: clk_hw pointers overwrite live spinlock/lockdep state, and every subsequent lock acquire/release writes into what the clk framework treats as its `hws[]` pointer array, with the lockdep path further using a corrupted `lock_class` pointer for indexed writes.\nA:H - A clobbered spinlock leaves it permanently appearing held, so the first `spin_lock_irqsave()` from a divider set_rate or gate enable spins forever with interrupts disabled (hard lockup), and on debug/lockdep or PREEMPT_RT kernels the corrupted lock internals cause an immediate wild-pointer oops."}]}],"providerMetadata":{"shortName":"Linux","orgId":"416baaa9-dc9f-4396-8d5f-8c081fb06d67","dateUpdated":"2026-08-05T11:44:33.733Z"},"cpeApplicability":[{"nodes":[{"operator":"OR","negate":false,"cpeMatch":[{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.10","versionEndExcluding":"6.11.11"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.10","versionEndExcluding":"6.12.2"},{"vulnerable":true,"criteria":"cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*","versionStartIncluding":"6.10","versionEndExcluding":"6.13"}]}]}],"x_generator":{"engine":"bippy-1.2.0"}},"adp":[{"title":"CISA ADP Vulnrichment","metrics":[{"cvssV3_1":{"scope":"UNCHANGED","version":"3.1","baseScore":7.8,"attackVector":"LOCAL","baseSeverity":"HIGH","vectorString":"CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H","integrityImpact":"HIGH","userInteraction":"NONE","attackComplexity":"LOW","availabilityImpact":"HIGH","privilegesRequired":"LOW","confidentialityImpact":"HIGH"}},{"other":{"type":"ssvc","content":{"id":"CVE-2024-53193","role":"CISA Coordinator","options":[{"Exploitation":"none"},{"Automatable":"no"},{"Technical Impact":"total"}],"version":"2.0.3","timestamp":"2025-10-01T20:04:04.188198Z"}}}],"problemTypes":[{"descriptions":[{"cweId":"CWE-787","lang":"en","type":"CWE","description":"CWE-787 Out-of-bounds Write"}]}],"providerMetadata":{"shortName":"CISA-ADP","orgId":"134c704f-9b21-4f2e-91b3-4a467353bcc0","dateUpdated":"2025-10-01T20:07:20.819Z"}}]}}}