Description
In the Linux kernel, the following vulnerability has been resolved:

dma-buf: dma-heap: don't publish fd before copy_to_user() succeeds

DMA_HEAP_IOCTL_ALLOC allocates a dma-buf and installs an fd into the
caller's fd table via dma_buf_fd() -> fd_install() before
dma_heap_ioctl() copies the result back to userspace. If the trailing
copy_to_user() fails, userspace never learns the fd number, but the
fd (and the underlying dma-buf reference) are already visible to
other threads in the same process and are leaked for the lifetime of
the process.

The obvious "close it on the failure path" fix is unsafe: once
fd_install() has run, another thread can already dup() the fd, send
it via SCM_RIGHTS, or close() it and let its number be reused, so a
subsequent close_fd() from the ioctl path can operate on an unrelated
file. This was pointed out by Christian König on v1 [1].

Restructure the allocation path so that fd_install() is the last,
unfailable step of a successful ioctl:

1. heap->ops->allocate() creates the dma_buf.
2. get_unused_fd_flags() reserves an fd number in the caller's
fd table without publishing it, so
no other thread can observe it.
3. copy_to_user() delivers the fd number to userspace;
on failure the fd is returned with
put_unused_fd() and the dma_buf
reference is dropped with
dma_buf_put(), leaving no user-
visible state behind.
4. dma_buf_fd_install() publishes the fd and emits the
trace_dma_buf_fd tracepoint -- from
here on the ioctl cannot fail.

A new dma_buf_fd_install() helper is introduced in dma-buf.c to wrap
fd_install() together with the DMA_BUF_TRACE() call, preserving the
export tracing that dma_buf_fd() provides. dma_heap_ioctl_allocate()
is refactored to return the struct dma_buf * directly (returning
ERR_PTR on failure) so the caller holds the dmabuf reference across
steps 3 and 4.

The failure at step 3 is easily reachable from userspace: pass a
struct dma_heap_allocation_data that lives in a page whose protection
is flipped to PROT_READ between copy_from_user() and copy_to_user()
(e.g. via mprotect()). Before this change each such ioctl leaks one
dmabuf fd; after it, the fd table is unchanged on failure and only
/dev/dma_heap/<name> remains open.

No UAPI or heap-driver interface change.

[1] https://lore.kernel.org/dri-devel/175e98de-f414-47d7-81c1-c0fe0a8f7f62@amd.com/
Published: 2026-09-16
Score: n/a
EPSS: < 1% Very Low
KEV: No
Impact: Leaked DMA buffer file descriptor resulting in resource leak (CWE‑573).
Action: Update Kernel
AI Analysis

Impact

The vulnerability occurs when the dma‑heap ioctl allocation process publishes a file descriptor before ensuring that the ioctl call completed successfully. If the final copy_to_user operation fails, the descriptor remains in the caller’s file descriptor table, leaking a reference to the underlying dma_buf. This leaked descriptor can then be accessed by other threads in the same process through dup, send via SCM_RIGHTS, or other file descriptor handling primitives, potentially allowing unintended access to the dma buffer’s contents or interference with its lifecycle. The flaw represents a classic resource‑management weakness (CWE‑573), potentially compromising confidentiality or integrity of memory shared via the dma_buf interface.

Affected Systems

The flaw affects the Linux kernel’s dma‑buf subsystem, specifically the dma‑heap ioctl handling in all kernel releases that include the buggy allocation logic. Affected vendors include any implementation of the Linux kernel, such as upstream Linux distributions and derivative kernels, prior to the kernel commit that introduced the dma_buf_fd_install() helper and reordered the allocation steps.

Risk and Exploitability

Because the vulnerability is triggered by a local ioctl request that fails during a copy_to_user operation, the attack requires local privileges and the ability to manipulate the dma‑heap allocation data to cause a copy error (e.g., via mprotect). The EPSS score is below 1 %, and the vulnerability is not listed in CISA’s KEV catalog, indicating a very low likelihood of exploitation in the wild. However, within a compromised or privileged local context, an attacker who can force the ioctl to fail could obtain a leaked dma_buf file descriptor and thereby gain indirect access to DMA shared memory, which may aid in privilege‑escalation or information‑exfiltration strategies.

Generated by OpenCVE AI on September 18, 2026 at 00:22 UTC.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Apply an updated Linux kernel that incorporates the dma‑heap allocation fix, which delays FD publishing until after a successful copy_to_user.
  • If an immediate kernel upgrade is not possible, restrict or disable access to /dev/dma_heap device nodes for untrusted processes, or adjust udev rules so that only privileged users can open these nodes.
  • As a temporary precaution, refuse real allocations from user-supplied dma‑heap allocation data that could lead to copy_to_user failures (e.g., reject allocations that would result in mprotect-induced failures).

Generated by OpenCVE AI on September 18, 2026 at 00:22 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Sat, 03 Oct 2026 11:15:00 +0000


Fri, 18 Sep 2026 00:45:00 +0000

Type Values Removed Values Added
Weaknesses CWE-573

Wed, 16 Sep 2026 10:45:00 +0000

Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: dma-buf: dma-heap: don't publish fd before copy_to_user() succeeds DMA_HEAP_IOCTL_ALLOC allocates a dma-buf and installs an fd into the caller's fd table via dma_buf_fd() -> fd_install() before dma_heap_ioctl() copies the result back to userspace. If the trailing copy_to_user() fails, userspace never learns the fd number, but the fd (and the underlying dma-buf reference) are already visible to other threads in the same process and are leaked for the lifetime of the process. The obvious "close it on the failure path" fix is unsafe: once fd_install() has run, another thread can already dup() the fd, send it via SCM_RIGHTS, or close() it and let its number be reused, so a subsequent close_fd() from the ioctl path can operate on an unrelated file. This was pointed out by Christian König on v1 [1]. Restructure the allocation path so that fd_install() is the last, unfailable step of a successful ioctl: 1. heap->ops->allocate() creates the dma_buf. 2. get_unused_fd_flags() reserves an fd number in the caller's fd table without publishing it, so no other thread can observe it. 3. copy_to_user() delivers the fd number to userspace; on failure the fd is returned with put_unused_fd() and the dma_buf reference is dropped with dma_buf_put(), leaving no user- visible state behind. 4. dma_buf_fd_install() publishes the fd and emits the trace_dma_buf_fd tracepoint -- from here on the ioctl cannot fail. A new dma_buf_fd_install() helper is introduced in dma-buf.c to wrap fd_install() together with the DMA_BUF_TRACE() call, preserving the export tracing that dma_buf_fd() provides. dma_heap_ioctl_allocate() is refactored to return the struct dma_buf * directly (returning ERR_PTR on failure) so the caller holds the dmabuf reference across steps 3 and 4. The failure at step 3 is easily reachable from userspace: pass a struct dma_heap_allocation_data that lives in a page whose protection is flipped to PROT_READ between copy_from_user() and copy_to_user() (e.g. via mprotect()). Before this change each such ioctl leaks one dmabuf fd; after it, the fd table is unchanged on failure and only /dev/dma_heap/<name> remains open. No UAPI or heap-driver interface change. [1] https://lore.kernel.org/dri-devel/175e98de-f414-47d7-81c1-c0fe0a8f7f62@amd.com/
Title dma-buf: dma-heap: don't publish fd before copy_to_user() succeeds
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References

Subscriptions

Linux Linux Kernel
cve-icon MITRE

Status: PUBLISHED

Assigner: Linux

Published:

Updated: 2026-10-03T10:56:55.800Z

Reserved: 2026-09-11T19:38:34.780Z

Link: CVE-2026-89996

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-09-16T11:17:10.810

Modified: 2026-10-03T11:17:45.290

Link: CVE-2026-89996

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-09-18T00:30:16Z

Weaknesses
  • CWE-573

    Improper Following of Specification by Caller