CVE-2025-40323

Source
https://cve.org/CVERecord?id=CVE-2025-40323
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-40323.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2025-40323
Downstream
Related
Published
2025-12-08T00:46:50.833Z
Modified
2026-03-20T12:43:16.171317Z
Summary
fbcon: Set fb_display[i]->mode to NULL when the mode is released
Details

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

fbcon: Set fb_display[i]->mode to NULL when the mode is released

Recently, we discovered the following issue through syzkaller:

BUG: KASAN: slab-use-after-free in fbmodeisequal+0x285/0x2f0 Read of size 4 at addr ff11000001b3c69c by task syz.xxx ... Call Trace: <TASK> dumpstacklvl+0xab/0xe0 printaddressdescription.constprop.0+0x2c/0x390 printreport+0xb9/0x280 kasanreport+0xb8/0xf0 fbmodeisequal+0x285/0x2f0 fbconmodedeleted+0x129/0x180 fbsetvar+0xe7f/0x11d0 dofbioctl+0x6a0/0x750 fb_ioctl+0xe0/0x140 __x64sysioctl+0x193/0x210 dosyscall64+0x5f/0x9c0 entrySYSCALL64afterhwframe+0x76/0x7e

Based on experimentation and analysis, during framebuffer unregistration, only the memory of fbinfo->modelist is freed, without setting the corresponding fbdisplay[i]->mode to NULL for the freed modes. This leads to UAF issues during subsequent accesses. Here's an example of reproduction steps: 1. With /dev/fb0 already registered in the system, load a kernel module to register a new device /dev/fb1; 2. Set fb1's mode to the global fbdisplay[] array (via FBIOPUTCON2FBMAP); 3. Switch console from fb to VGA (to allow normal rmmod of the ko); 4. Unload the kernel module, at this point fb1's modelist is freed, leaving a wild pointer in fb_display[]; 5. Trigger the bug via system calls through fb0 attempting to delete a mode from fb0.

Add a check in dounregisterframebuffer(): if the mode to be freed exists in fb_display[], set the corresponding mode pointer to NULL.

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2025/40xxx/CVE-2025-40323.json"
}
References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
1da177e4c3f41524e886b7f1b8a0c1fc7321cac2
Fixed
4ac18f0e6a6d599ca751c4cd98e522afc8e3d4eb
Fixed
468f78276a37f4c6499385a4ce28f4f57be6655d
Fixed
c079d42f70109512eee49123a843be91d8fa133f
Fixed
de89d19f4f30d9a8de87b9d08c1bd35cb70576d8
Fixed
a1f3058930745d2b938b6b4f5bd9630dc74b26b7

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-40323.json"

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
2.6.12
Fixed
6.1.159
Type
ECOSYSTEM
Events
Introduced
6.2.0
Fixed
6.6.117
Type
ECOSYSTEM
Events
Introduced
6.7.0
Fixed
6.12.58
Type
ECOSYSTEM
Events
Introduced
6.13.0
Fixed
6.17.8

Database specific

source
"https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2025-40323.json"