Bug 1226844 (CVE-2024-38592) - VUL-0: CVE-2024-38592: kernel: drm/mediatek: init `ddp_comp` with devm_kcalloc()
Summary: VUL-0: CVE-2024-38592: kernel: drm/mediatek: init `ddp_comp` with devm_kcalloc()
Status: RESOLVED FIXED
Alias: CVE-2024-38592
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents (show other bugs)
Version: unspecified
Hardware: Other Other
: P3 - Medium : Normal
Target Milestone: ---
Assignee: Security Team bot
QA Contact: Security Team bot
URL: https://smash.suse.de/issue/411371/
Whiteboard: CVSSv3.1:SUSE:CVE-2024-38592:5.5:(AV:...
Keywords:
Depends on:
Blocks:
 
Reported: 2024-06-24 09:36 UTC by SMASH SMASH
Modified: 2024-07-08 15:14 UTC (History)
2 users (show)

See Also:
Found By: Security Response Team
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description SMASH SMASH 2024-06-24 09:36:38 UTC
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.

References:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2024-38592
https://git.kernel.org/pub/scm/linux/security/vulns.git/plain/cve/published/2024/CVE-2024-38592.mbox
https://git.kernel.org/stable/c/cf69d0af7db917b82aceaa44b7b1b9376609da22
https://git.kernel.org/stable/c/9fe2cc3fa44f7ad7ba5f29c1a68b2b924c17b9b1
https://git.kernel.org/stable/c/01a2c5123e27b3c4685bf2fc4c2e879f6e0c7b33
https://www.cve.org/CVERecord?id=CVE-2024-38592
https://bugzilla.redhat.com/show_bug.cgi?id=2293385