f2fs: atomic: fix UAF issue on f2fs_inode_info.atomic_inode
Linux
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
Linux
| Product | Affected | Fixed in |
|---|---|---|
| Linux Linux |
|
6db52f1944417c2601182a591a704e2f119c5215| No fix yet |
| Linux Linux |
|
|
In the Linux kernel, the following vulnerability has been resolved:
f2fs: atomic: fix UAF issue on f2fs_inode_info.atomic_inode
- ioctl(F2FS_IOC_GARBAGE_COLLECT_RANGE) - shrink - f2fs_gc - gc_data_segment - ra_data_block(cow_inode) - mapping = F2FS_I(inode)->atomic_inode->i_mapping : f2fs_is_cow_file(cow_inode) is true - f2fs_evict_inode(atomic_inode) - clear_inode_flag(fi->cow_inode, FI_COW_FILE) - F2FS_I(fi->cow_inode)->atomic_inode = NULL ... - truncate_inode_pages_final(atomic_inode) - f2fs_grab_cache_folio(mapping) : create folio in atomic_inode->mapping - clear_inode(atomic_inode) - BUG_ON(atomic_inode->i_data.nrpages)
We need to add a reference on fi->atomic_inode before using its mapping field during garbage collection, otherwise, it will cause UAF issue.
From the CVE record · Linux
The Linux kernel’s f2fs garbage collection can use an atomic inode’s mapping without holding a reference to the inode. A local caller invoking the garbage-collection-range ioctl could trigger a use-after-free if the inode is evicted concurrently; authentication requirements and any need for user interaction are not specified.
Engineers running Linux kernels with f2fs should check their versions against the vendor advisory; affected versions are not specified.