In the Linux kernel, the following vulnerability has been resolved:
lib/testhmm.c: handle srcpfns and dst_pfns allocation failure
The kcalloc() in dmirrordeviceevictchunk() will return null if the physical memory has run out. As a result, if srcpfns or dst_pfns is dereferenced, the null pointer dereference bug will happen.
Moreover, the device is going away. If the kcalloc() fails, the pages mapping a chunk could not be evicted. So add a _GFPNOFAIL flag in kcalloc().
Finally, as there is no need to have physically contiguous memory, Switch kcalloc() to kvcalloc() in order to avoid failing allocations.
[
{
"signature_type": "Function",
"deprecated": false,
"signature_version": "v1",
"digest": {
"length": 1011.0,
"function_hash": "113408752020212335672926792250620552281"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ce47e8ead9a72834cc68431d53f8092ce69bebb7",
"target": {
"file": "lib/test_hmm.c",
"function": "dmirror_device_evict_chunk"
},
"id": "CVE-2024-38543-20a60a9b"
},
{
"signature_type": "Function",
"deprecated": false,
"signature_version": "v1",
"digest": {
"length": 1011.0,
"function_hash": "113408752020212335672926792250620552281"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1a21fdeea502658e315bd939409b755974f4fb64",
"target": {
"file": "lib/test_hmm.c",
"function": "dmirror_device_evict_chunk"
},
"id": "CVE-2024-38543-3cd347e7"
},
{
"signature_type": "Function",
"deprecated": false,
"signature_version": "v1",
"digest": {
"length": 1011.0,
"function_hash": "113408752020212335672926792250620552281"
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c2af060d1c18beaec56351cf9c9bcbbc5af341a3",
"target": {
"file": "lib/test_hmm.c",
"function": "dmirror_device_evict_chunk"
},
"id": "CVE-2024-38543-555e1591"
},
{
"signature_type": "Line",
"deprecated": false,
"signature_version": "v1",
"digest": {
"line_hashes": [
"54297623313599677980196844191015403944",
"329470228294569701934738161508840784365",
"255084185976078464956865529428990617698",
"37424157980265462019395293169050803371",
"185667054452716887954108822360791614705",
"262831297862056047516442558932529891282",
"189540069312518251608825112009496940938",
"205457116770054350401044999159621241345",
"165928567168890685620284087028484314351",
"188659076264862217100662858733014438324"
],
"threshold": 0.9
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@ce47e8ead9a72834cc68431d53f8092ce69bebb7",
"target": {
"file": "lib/test_hmm.c"
},
"id": "CVE-2024-38543-95db7846"
},
{
"signature_type": "Line",
"deprecated": false,
"signature_version": "v1",
"digest": {
"line_hashes": [
"54297623313599677980196844191015403944",
"329470228294569701934738161508840784365",
"255084185976078464956865529428990617698",
"37424157980265462019395293169050803371",
"185667054452716887954108822360791614705",
"262831297862056047516442558932529891282",
"189540069312518251608825112009496940938",
"205457116770054350401044999159621241345",
"165928567168890685620284087028484314351",
"188659076264862217100662858733014438324"
],
"threshold": 0.9
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c2af060d1c18beaec56351cf9c9bcbbc5af341a3",
"target": {
"file": "lib/test_hmm.c"
},
"id": "CVE-2024-38543-9c8d2d7e"
},
{
"signature_type": "Line",
"deprecated": false,
"signature_version": "v1",
"digest": {
"line_hashes": [
"54297623313599677980196844191015403944",
"329470228294569701934738161508840784365",
"255084185976078464956865529428990617698",
"37424157980265462019395293169050803371",
"185667054452716887954108822360791614705",
"262831297862056047516442558932529891282",
"189540069312518251608825112009496940938",
"205457116770054350401044999159621241345",
"165928567168890685620284087028484314351",
"188659076264862217100662858733014438324"
],
"threshold": 0.9
},
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@1a21fdeea502658e315bd939409b755974f4fb64",
"target": {
"file": "lib/test_hmm.c"
},
"id": "CVE-2024-38543-b78b8822"
}
]