CVE-2024-49870: cachefiles: fix dentry leak in cachefiles_open_file()
In the Linux kernel, the following vulnerability has been resolved:
cachefiles: fix dentry leak in cachefilesopenfile()
A dentry leak may be caused when a lookup cookie and a cull are concurrent:
P1 | P2 ----------------------------------------------------------- cachefileslookupcookie cachefileslookupobject lookuponepositiveunlocked // get dentry cachefilescull inode->iflags |= SKERNELFILE; cachefilesopenfile cachefilesmarkinodeinuse cachefilesmarkinodeinuse canuse = false if (!(inode->iflags & SKERNELFILE)) canuse = true return false return false // Returns an error but doesn't put dentry
After that the following WARNING will be triggered when the backend folder is umounted:
================================================================== BUG: Dentry 000000008ad87947{i=7a,n=Dx11.img} still in use (1) [unmount of ext4 sda] WARNING: CPU: 4 PID: 359261 at fs/dcache.c:1767 umountcheck+0x5d/0x70 CPU: 4 PID: 359261 Comm: umount Not tainted 6.6.0-dirty #25 RIP: 0010:umountcheck+0x5d/0x70 Call Trace: <TASK> dwalk+0xda/0x2b0 doonetree+0x20/0x40 shrinkdcacheforumount+0x2c/0x90 genericshutdownsuper+0x20/0x160 killblocksuper+0x1a/0x40 ext4killsb+0x22/0x40 deactivatelockedsuper+0x35/0x80 cleanupmnt+0x104/0x160 ==================================================================
Whether cachefilesopenfile() returns true or false, the reference count obtained by lookuppositiveunlocked() in cachefileslookupobject() should be released.
Therefore release that reference count in cachefileslookupobject() to fix the above issue and simplify the code.
Other sources
In the Linux kernel, the following vulnerability has been resolved:
cachefiles: fix dentry leak in cachefilesopenfile()
A dentry leak may be caused when a lookup cookie and a cull are concurrent:
P1 | P2 ----------------------------------------------------------- cachefileslookupcookie cachefileslookupobject lookuponepositiveunlocked // get dentry cachefilescull inode->iflags |= SKERNELFILE; cachefilesopenfile cachefilesmarkinodeinuse cachefilesmarkinodeinuse canuse = false if (!(inode->iflags & SKERNELFILE)) canuse = true return false return false // Returns an error but doesn't put dentry
After that the following WARNING will be triggered when the backend folder is umounted:
================================================================== BUG: Dentry 000000008ad87947{i=7a,n=Dx11.img} still in use (1) [unmount of ext4 sda] WARNING: CPU: 4 PID: 359261 at fs/dcache.c:1767 umountcheck+0x5d/0x70 CPU: 4 PID: 359261 Comm: umount Not tainted 6.6.0-dirty #25 RIP: 0010:umountcheck+0x5d/0x70 Call Trace: <TASK> dwalk+0xda/0x2b0 doonetree+0x20/0x40 shrinkdcacheforumount+0x2c/0x90 genericshutdownsuper+0x20/0x160 killblocksuper+0x1a/0x40 ext4killsb+0x22/0x40 deactivatelockedsuper+0x35/0x80 cleanupmnt+0x104/0x160 ==================================================================
Whether cachefilesopenfile() returns true or false, the reference count obtained by lookuppositiveunlocked() in cachefileslookupobject() should be released.
Therefore release that reference count in cachefileslookupobject() to fix the above issue and simplify the code.
— NVD
This CVE was automatically created from a reference found in an email or other text. If you are reading this, then this CVE entry is probably erroneous, since this text should be replaced by the official CVE description automatically.
— Launchpad
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2024-49870?
The severity of CVE-2024-49870 has not been explicitly stated but generally falls under the category of kernel vulnerabilities which can lead to serious system performance issues.
How do I fix CVE-2024-49870?
To fix CVE-2024-49870, update your Linux kernel to the latest patched version that addresses this vulnerability.
What versions of the Linux kernel are affected by CVE-2024-49870?
CVE-2024-49870 affects several versions of the Linux kernel from 5.17 to the pre-release versions of 6.12-rc1.
What are the potential impacts of CVE-2024-49870?
The potential impacts of CVE-2024-49870 include performance degradation due to the dentry leak in concurrent operations.
Is there a workaround for CVE-2024-49870?
There are no recommended workarounds for CVE-2024-49870 other than applying the available kernel updates.