CVE-2024-56712 udmabuf: fix memory leak on last export_udmabuf() error path

Low 3.3 Published Updated

A memory leak in the Linux kernel udmabuf driver allows local attackers to exhaust system memory, potentially causing denial of service.

Exploited in the wild
Not known
Login needed
Any signed-in user
Attackable
Local or same network only
Victim action needed
Not needed
Fix
Available

What is CVE-2024-56712?

CVE-2024-56712 is a low-severity memory corruption vulnerability in Linux kernel, published on 29 Dec 2024. It can only be exploited from the same machine or local network, with no action from the victim.

Official 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.

Weakness: CWE-401

Which versions are affected by CVE-2024-56712?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2024-56712?

Apply the vendor's patch.

Upgrade to the fixed version. Memory-safe languages, compiler hardening and fuzzing prevent most new cases. More about Memory corruption.

Is CVE-2024-56712 being exploited?

There is no known exploitation of CVE-2024-56712 in the wild and no public exploit code.

All Linux kernel vulnerabilities

Sources

Also known as AZL-54768, AZL-54896, BELL-CVE-2024-56712, DEBIAN-CVE-2024-56712, GHSA-5546-cr76-j66r, ROOT-OS-DEBIAN-11-CVE-2024-56712 and 4 more.

Is CVE-2024-56712 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free