In the Linux kernel, the following vulnerability has been resolved:
udmabuf: fix memory leak on last export_udmabuf() error path
In exportudmabuf(), if dmabuffd() fails because the FD table is full, a dmabuf owning the udmabuf has already been created; but the error handling in udmabufcreate() will tear down the udmabuf without doing anything about the containing dmabuf.
This leaves a dma_buf in memory that contains a dangling pointer; though that doesn't seem to lead to anything bad except a memory leak.
Fix it by moving the dmabuffd() call out of export_udmabuf() so that we can give it different error handling.
Note that the shape of this code changed a lot in commit 5e72b2b41a21 ("udmabuf: convert udmabuf driver to use folios"); but the memory leak seems to have existed since the introduction of udmabuf.
[
{
"id": "CVE-2024-56712-0d967f68",
"target": {
"file": "drivers/dma-buf/udmabuf.c"
},
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f49856f525acd5bef52ae28b7da2e001bbe7439e",
"digest": {
"threshold": 0.9,
"line_hashes": [
"136427771967511190343469394067471167352",
"318474682849467405467384683462578836453",
"48198684478032034344233748886369551885",
"240218149160062167341968715035974612426",
"3726133120331953338416602562489702316",
"331286286710860806744105934357437696822",
"195737056653314270436904172758261790682",
"194738379437107011498449104209962743656",
"331456071710087329664166712335076756210",
"251907666777353278698795139411939910524",
"163529032775890385854443405703926515809",
"44497126890649216053537188973980736258",
"120099392105475173002369397264938659725",
"37194805807914527226401730596312893322",
"76187622697404539963217175951469899028",
"309001699450301485542118230249620130567",
"250129296195448228650342258320050214679",
"44943166896192603390343058306439361401",
"175461050616981318633708948165202839042",
"219026932552397318188415356161625883303",
"81106228602405177293423862775689370656",
"15316512577201772418620189449686157427",
"295194179720333430651726486499868272009",
"32495156720389270145247680502088080401",
"105509666832630769906359814670628571324",
"104799936497375047124891679242011379063"
]
},
"deprecated": false,
"signature_version": "v1"
},
{
"id": "CVE-2024-56712-42cec7d9",
"target": {
"file": "drivers/dma-buf/udmabuf.c"
},
"signature_type": "Line",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c9fc8428d4255c2128da9c4d5cd92e554d0150cf",
"digest": {
"threshold": 0.9,
"line_hashes": [
"136427771967511190343469394067471167352",
"318474682849467405467384683462578836453",
"48198684478032034344233748886369551885",
"240218149160062167341968715035974612426",
"3726133120331953338416602562489702316",
"331286286710860806744105934357437696822",
"195737056653314270436904172758261790682",
"194738379437107011498449104209962743656",
"331456071710087329664166712335076756210",
"251907666777353278698795139411939910524",
"163529032775890385854443405703926515809",
"44497126890649216053537188973980736258",
"120099392105475173002369397264938659725",
"37194805807914527226401730596312893322",
"76187622697404539963217175951469899028",
"71869507509897484598315697188318395520",
"180911017062876869402183682107514073366",
"1413849763438939682109139608938643609",
"175461050616981318633708948165202839042",
"219026932552397318188415356161625883303",
"81106228602405177293423862775689370656",
"15316512577201772418620189449686157427",
"295194179720333430651726486499868272009",
"334194004477399163913714990089527479160",
"12570412197296439906867888619066810002",
"236470354260473272509664701184943963564"
]
},
"deprecated": false,
"signature_version": "v1"
},
{
"id": "CVE-2024-56712-8849fd45",
"target": {
"function": "udmabuf_create",
"file": "drivers/dma-buf/udmabuf.c"
},
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f49856f525acd5bef52ae28b7da2e001bbe7439e",
"digest": {
"function_hash": "340200958851157011904607553482162506019",
"length": 1496.0
},
"deprecated": false,
"signature_version": "v1"
},
{
"id": "CVE-2024-56712-8ace86fb",
"target": {
"function": "export_udmabuf",
"file": "drivers/dma-buf/udmabuf.c"
},
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c9fc8428d4255c2128da9c4d5cd92e554d0150cf",
"digest": {
"function_hash": "272093603852744312893490016610279961262",
"length": 392.0
},
"deprecated": false,
"signature_version": "v1"
},
{
"id": "CVE-2024-56712-c900ed16",
"target": {
"function": "udmabuf_create",
"file": "drivers/dma-buf/udmabuf.c"
},
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@c9fc8428d4255c2128da9c4d5cd92e554d0150cf",
"digest": {
"function_hash": "295054873216120953881915587509855752240",
"length": 1459.0
},
"deprecated": false,
"signature_version": "v1"
},
{
"id": "CVE-2024-56712-e8d14b1a",
"target": {
"function": "export_udmabuf",
"file": "drivers/dma-buf/udmabuf.c"
},
"signature_type": "Function",
"source": "https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git@f49856f525acd5bef52ae28b7da2e001bbe7439e",
"digest": {
"function_hash": "272093603852744312893490016610279961262",
"length": 392.0
},
"deprecated": false,
"signature_version": "v1"
}
]