Skip to contentSkip to conversation

CVE-2026-63816: f2fs: atomic: fix UAF issue on f2fs_inode_info.atomic_inode

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Jul 19

lore
Share & tools
lore
#0 lore raw

From: Greg Kroah-Hartman <[email protected]>

Description
===========

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.

The Linux kernel CVE team has assigned CVE-2026-63816 to this issue.

Affected and fixed versions
===========================

	Issue introduced in 5.19 with commit 3db1de0e582c358dd013f3703cd55b5fe4076436 and fixed in 6.12.96 with commit 56038756aae68312df00d4aa1d97e51ef3aca725
	Issue introduced in 5.19 with commit 3db1de0e582c358dd013f3703cd55b5fe4076436 and fixed in 6.18.39 with commit a499f77c06050a28c897bdbd86cd2f0721ae0743
	Issue introduced in 5.19 with commit 3db1de0e582c358dd013f3703cd55b5fe4076436 and fixed in 7.1.3 with commit a805fec35c201c59643ddcde713bce4051c8ee27
	Issue introduced in 5.19 with commit 3db1de0e582c358dd013f3703cd55b5fe4076436 and fixed in 7.2-rc1 with commit e0288584baa5dc41df4a829a023c4c1b33fe53d7
	Issue introduced in 5.18.18 with commit 6db52f1944417c2601182a591a704e2f119c5215

Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.

Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at

	https://cve.org/CVERecord/?id=CVE-2026-63816

will be updated if fixes are backported, please check that for the most up to date information about this issue.

Affected files
==============

The file(s) affected by this issue are:

	fs/f2fs/gc.c
	fs/f2fs/inode.c

Mitigation
==========

The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:

	https://git.kernel.org/stable/c/56038756aae68312df00d4aa1d97e51ef3aca725
	https://git.kernel.org/stable/c/a499f77c06050a28c897bdbd86cd2f0721ae0743
	https://git.kernel.org/stable/c/a805fec35c201c59643ddcde713bce4051c8ee27
	https://git.kernel.org/stable/c/e0288584baa5dc41df4a829a023c4c1b33fe53d7