dma-buf/dma-resv: Stop leaking on krealloc() failure
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
| No fix yet |
| Linux Linux |
|
|
6.1.426.4.76.5In the Linux kernel, the following vulnerability has been resolved:
dma-buf/dma-resv: Stop leaking on krealloc() failure
Currently dma_resv_get_fences() will leak the previously allocated array if the fence iteration got restarted and the krealloc_array() fails.
Free the old array by hand, and make sure we still clear the returned *fences so the caller won't end up accessing freed memory. Some (but not all) of the callers of dma_resv_get_fences() seem to still trawl through the array even when dma_resv_get_fences() failed. And let's zero out *num_fences as well for good measure.
From the CVE record · Linux
The Linux kernel's dma_resv_get_fences() can leak a previously allocated array if fence iteration restarts and krealloc_array() fails. Callers may also access freed memory after the failure. The input does not establish how an attacker could trigger these conditions or whether authentication or user interaction is needed.
Teams running the Linux kernel should check their installations; affected versions were not provided.