CVE-2024-38592 drm/mediatek: Init `ddp_comp` with devm_kcalloc()

High 7.8 Published Updated

A missing initialization in the Mediatek DRM driver can cause a kernel crash when specific debug options are enabled, leading to 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-38592?

CVE-2024-38592 is a high-severity vulnerability in Linux kernel, published on 19 Jun 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:

drm/mediatek: Init `ddp_comp` with devm_kcalloc()

In the case where `conn_routes` is true we allocate an extra slot in the `ddp_comp` array but mtk_drm_crtc_create() never seemed to initialize it in the test case I ran. For me, this caused a later crash when we looped through the array in mtk_drm_crtc_mode_valid(). This showed up for me when I booted with `slub_debug=FZPUA` which poisons the memory initially. Without `slub_debug` I couldn't reproduce, presumably because the later code handles the value being NULL and in most cases (not guaranteed in all cases) the memory the allocator returned started out as 0.

It really doesn't hurt to initialize the array with devm_kcalloc() since the array is small and the overhead of initting a handful of elements to 0 is small. In general initting memory to zero is a safer practice and usually it's suggested to only use the non-initting alloc functions if you really need to.

Let's switch the function to use an allocation function that zeros the memory. For me, this avoids the crash.

Weakness: CWE-908

Which versions are affected by CVE-2024-38592?

It affects 1 product.

Products include Linux kernel.

How do I fix CVE-2024-38592?

Apply the vendor's patch.

Is CVE-2024-38592 being exploited?

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

All Linux kernel vulnerabilities

Sources

Also known as BELL-CVE-2024-38592, DEBIAN-CVE-2024-38592, GHSA-9mq7-fm24-r296, UBUNTU-CVE-2024-38592.

Is CVE-2024-38592 in your software?

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

Check your SBOMs for free