In the Linux kernel, the following vulnerability has been resolved:
of: module: prevent NULL pointer dereference in vsnprintf()
In ofmodalias(), we can get passed the str and len parameters which would cause a kernel oops in vsnprintf() since it only allows passing a NULL ptr when the length is also 0. Also, we need to filter out the negative values of the len parameter as these will result in a really huge buffer since snprintf() takes sizet parameter while ours is ssize_t...
Found by Linux Verification Center (linuxtesting.org) with the Svace static analysis tool.
[
{
"signature_type": "Line",
"target": {
"file": "drivers/of/module.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a1aa5390cc912934fee76ce80af5f940452fa987",
"deprecated": false,
"id": "CVE-2024-35878-32e7f7f1",
"signature_version": "v1",
"digest": {
"line_hashes": [
"220993470896492776201381344581740815249",
"218759772730606846924884374711283025488",
"43344045917278489596283999290836121658"
],
"threshold": 0.9
}
},
{
"signature_type": "Line",
"target": {
"file": "drivers/of/module.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@544561dc56f7e69a053c25e11e6170f48bb97898",
"deprecated": false,
"id": "CVE-2024-35878-a3b67b1d",
"signature_version": "v1",
"digest": {
"line_hashes": [
"220993470896492776201381344581740815249",
"218759772730606846924884374711283025488",
"43344045917278489596283999290836121658"
],
"threshold": 0.9
}
},
{
"signature_type": "Function",
"target": {
"function": "of_modalias",
"file": "drivers/of/module.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@a1aa5390cc912934fee76ce80af5f940452fa987",
"deprecated": false,
"id": "CVE-2024-35878-a809dd42",
"signature_version": "v1",
"digest": {
"length": 611.0,
"function_hash": "79722615483041881603629778213368311301"
}
},
{
"signature_type": "Line",
"target": {
"file": "drivers/of/module.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e4a449368a2ce6d57a775d0ead27fc07f5a86e5b",
"deprecated": false,
"id": "CVE-2024-35878-affc791c",
"signature_version": "v1",
"digest": {
"line_hashes": [
"220993470896492776201381344581740815249",
"218759772730606846924884374711283025488",
"43344045917278489596283999290836121658"
],
"threshold": 0.9
}
},
{
"signature_type": "Function",
"target": {
"function": "of_modalias",
"file": "drivers/of/module.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@544561dc56f7e69a053c25e11e6170f48bb97898",
"deprecated": false,
"id": "CVE-2024-35878-d3fa95de",
"signature_version": "v1",
"digest": {
"length": 611.0,
"function_hash": "79722615483041881603629778213368311301"
}
},
{
"signature_type": "Function",
"target": {
"function": "of_modalias",
"file": "drivers/of/module.c"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@e4a449368a2ce6d57a775d0ead27fc07f5a86e5b",
"deprecated": false,
"id": "CVE-2024-35878-f80c4531",
"signature_version": "v1",
"digest": {
"length": 611.0,
"function_hash": "79722615483041881603629778213368311301"
}
}
]