Bug 2120664 (CVE-2022-2978)

Summary: CVE-2022-2978 kernel: use-after-free in nilfs_mdt_destroy
Product: [Other] Security Response Reporter: Alex <allarkin>
Component: vulnerabilityAssignee: Red Hat Product Security <security-response-team>
Status: CLOSED WONTFIX QA Contact:
Severity: medium Docs Contact:
Priority: medium    
Version: unspecifiedCC: acaringi, adscvr, airlied, alciregi, bdettelb, bhu, brdeoliv, bskeggs, chwhite, crwood, ddepaula, debarbos, dhoward, dvlasenk, esandeen, fhrbata, hdegoede, hkrzesin, hpa, jarod, jarodwilson, jburrell, jfaracco, jferlan, jforbes, jglisse, jlelli, joe.lawrence, jonathan, josef, jshortt, jstancek, jwboyer, jwyatt, kcarcia, kernel-maint, kernel-mgr, lgoncalv, linville, lleshchi, lzampier, masami256, mchehab, nmurray, ptalbert, qzhao, rvrbovsk, scweaver, steve.beattie, steved, tyberry, vkumar, walters, williams
Target Milestone: ---Keywords: Security
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Linux kernel 6.0-rc3 Doc Type: If docs needed, set a value
Doc Text:
A use-after-free flaw was found in the Linux kernel’s NILFS file system in the way a user triggers the security_inode_alloc function to fail with the following call to the nilfs_mdt_destroy function. This flaw allows a local user to crash or potentially escalate their privileges on the system.
Story Points: ---
Clone Of: Environment:
Last Closed: 2022-11-27 12:56:15 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 2121049, 2121052, 2121054    
Bug Blocks: 2119315    

Description Alex 2022-08-23 13:51:19 UTC
A flaw use after free in the Linux Kernel found in fs/inode.c.
If security_inode_alloc fails, then in alloc_inode the inode_init_always could return -NOMEM.
In its error handling, i_callback and nilfs_free_inode will be called.
However, because inode->i_private is not initialized due to the failure of security_inode_alloc, the function nilfs_is_metadata_file_inode can return true and nilfs_free_inode() wrongly calls nilfs_mdt_destroy(), which frees the uninitialized inode->i_private and leads to crash.

Reference:
https://lore.kernel.org/linux-fsdevel/20220816040859.659129-1-dzm91@hust.edu.cn/T/#u

Comment 2 Alex 2022-08-24 10:45:08 UTC
Created kernel tracking bugs for this issue:

Affects: fedora-all [bug 2121049]

Comment 9 Rohit Keshri 2022-09-16 05:19:40 UTC
There was no shipped kernel version that was seen affected by this problem. These files are not built in our source code.

Comment 11 Product Security DevOps Team 2022-11-27 12:56:10 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2022-2978

Comment 12 Justin M. Forbes 2022-11-30 22:28:12 UTC
This was fixed for Fedora with the 6.0 stable kernel rebases.