2025-01-05 03:03:46 +00:00

33 lines
4.2 KiB
JSON

{
"id": "CVE-2024-53193",
"sourceIdentifier": "416baaa9-dc9f-4396-8d5f-8c081fb06d67",
"published": "2024-12-27T14:15:26.897",
"lastModified": "2024-12-27T14:15:26.897",
"vulnStatus": "Awaiting Analysis",
"cveTags": [],
"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]"
},
{
"lang": "es",
"value": "En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: clk: clk-loongson2: Se corrige un error de corrupci\u00f3n de memoria en struct loongson2_clk_provider. Se asigna algo de espacio de mont\u00f3n para la estructura flexible `struct clk_hw_onecell_data` y su miembro de matriz flexible `hws` a trav\u00e9s de la estructura compuesta `struct loongson2_clk_provider` en la funci\u00f3n `loongson2_clk_probe()`, como se muestra a continuaci\u00f3n: 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); Luego, se escriben algunos datos en la matriz flexible: 350 clp->clk_data.hws[p->id] = hw; Esto corrompe `clk_lock`, que es la variable spinlock que sigue inmediatamente al miembro `clk_data` en `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; /* proteger el acceso a los registros DIV */ }; El problema es que la estructura flexible actualmente est\u00e1 ubicada en el medio de `struct loongson2_clk_provider` en lugar de al final. Solucione esto moviendo `struct clk_hw_onecell_data clk_data;` al final de `struct loongson2_clk_provider`. Adem\u00e1s, agregue un comentario de c\u00f3digo para ayudar a evitar que esto vuelva a suceder en caso de que se agreguen nuevos miembros a la estructura en el futuro. Este cambio tambi\u00e9n corrige la siguiente advertencia -Wflex-array-member-not-at-end: drivers/clk/clk-loongson2.c:32:36: advertencia: la estructura que contiene un miembro de matriz flexible no est\u00e1 al final de otra estructura [-Wflex-array-member-not-at-end]"
}
],
"metrics": {},
"references": [
{
"url": "https://git.kernel.org/stable/c/145de18065b9840687d9b4e63746238c1da25d22",
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
},
{
"url": "https://git.kernel.org/stable/c/6e4bf018bb040955da53dae9f8628ef8fcec2dbe",
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
},
{
"url": "https://git.kernel.org/stable/c/76918202615f2ba7deda14901d9fff528a180099",
"source": "416baaa9-dc9f-4396-8d5f-8c081fb06d67"
}
]
}