| From bippy-5f407fcff5a0 Mon Sep 17 00:00:00 2001 |
| From: Greg Kroah-Hartman <gregkh@linuxfoundation.org> |
| To: <linux-cve-announce@vger.kernel.org> |
| Reply-to: <cve@kernel.org>, <linux-kernel@vger.kernel.org> |
| Subject: CVE-2024-56712: udmabuf: fix memory leak on last export_udmabuf() error path |
| |
| Description |
| =========== |
| |
| In the Linux kernel, the following vulnerability has been resolved: |
| |
| udmabuf: fix memory leak on last export_udmabuf() error path |
| |
| In export_udmabuf(), if dma_buf_fd() fails because the FD table is full, a |
| dma_buf owning the udmabuf has already been created; but the error handling |
| in udmabuf_create() will tear down the udmabuf without doing anything about |
| the containing dma_buf. |
| |
| 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 dma_buf_fd() 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. |
| |
| The Linux kernel CVE team has assigned CVE-2024-56712 to this issue. |
| |
| |
| Affected and fixed versions |
| =========================== |
| |
| Issue introduced in 4.20 with commit fbb0de795078190a9834b3409e4b009cfb18a6d4 and fixed in 6.12.7 with commit c9fc8428d4255c2128da9c4d5cd92e554d0150cf |
| Issue introduced in 4.20 with commit fbb0de795078190a9834b3409e4b009cfb18a6d4 and fixed in 6.13 with commit f49856f525acd5bef52ae28b7da2e001bbe7439e |
| |
| Please see https://www.kernel.org for a full list of currently supported |
| kernel versions by the kernel community. |
| |
| Unaffected versions might change over time as fixes are backported to |
| older supported kernel versions. The official CVE entry at |
| https://cve.org/CVERecord/?id=CVE-2024-56712 |
| will be updated if fixes are backported, please check that for the most |
| up to date information about this issue. |
| |
| |
| Affected files |
| ============== |
| |
| The file(s) affected by this issue are: |
| drivers/dma-buf/udmabuf.c |
| |
| |
| Mitigation |
| ========== |
| |
| The Linux kernel CVE team recommends that you update to the latest |
| stable kernel version for this, and many other bugfixes. Individual |
| changes are never tested alone, but rather are part of a larger kernel |
| release. Cherry-picking individual commits is not recommended or |
| supported by the Linux kernel community at all. If however, updating to |
| the latest release is impossible, the individual changes to resolve this |
| issue can be found at these commits: |
| https://git.kernel.org/stable/c/c9fc8428d4255c2128da9c4d5cd92e554d0150cf |
| https://git.kernel.org/stable/c/f49856f525acd5bef52ae28b7da2e001bbe7439e |