Skip to contentSkip to conversation

CVE-2023-53804: nilfs2: fix use-after-free bug of nilfs_root in nilfs_evict_inode()

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Dec 9, 2025

lore
Share & tools
lore
#0 lore raw

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

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

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

nilfs2: fix use-after-free bug of nilfs_root in nilfs_evict_inode()

During unmount process of nilfs2, nothing holds nilfs_root structure after nilfs2 detaches its writer in nilfs_detach_log_writer(). However, since nilfs_evict_inode() uses nilfs_root for some cleanup operations, it may cause use-after-free read if inodes are left in "garbage_list" and released by nilfs_dispose_list() at the end of nilfs_detach_log_writer().

Fix this issue by modifying nilfs_evict_inode() to only clear inode without additional metadata changes that use nilfs_root if the file system is degraded to read-only or the writer is detached.

The Linux kernel CVE team has assigned CVE-2023-53804 to this issue.

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

	Fixed in 4.14.316 with commit f31e18131ee2ce80a4da5c808221d25b1ae9ad6d
	Fixed in 4.19.284 with commit 2a782ea8ebd712a458466e3103e2881b4f886cb5
	Fixed in 5.4.244 with commit 116d53f09ff52e6f98e3fe1f85d8898d6ba26c68
	Fixed in 5.10.181 with commit 6b4205ea97901f822004e6c8d59484ccfda03faa
	Fixed in 5.15.113 with commit b8427b8522d9ede53015ba45a9978ba68d1162f5
	Fixed in 6.1.30 with commit acc2a40e428f12780004e1e9fce4722d88f909fd
	Fixed in 6.3.4 with commit fb8e8d58f116d069e5939e1f786ac84e7fa4533e
	Fixed in 6.4 with commit 9b5a04ac3ad9898c4745cba46ea26de74ba56a8e

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-2023-53804

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/nilfs2/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/f31e18131ee2ce80a4da5c808221d25b1ae9ad6d
	https://git.kernel.org/stable/c/2a782ea8ebd712a458466e3103e2881b4f886cb5
	https://git.kernel.org/stable/c/116d53f09ff52e6f98e3fe1f85d8898d6ba26c68
	https://git.kernel.org/stable/c/6b4205ea97901f822004e6c8d59484ccfda03faa
	https://git.kernel.org/stable/c/b8427b8522d9ede53015ba45a9978ba68d1162f5
	https://git.kernel.org/stable/c/acc2a40e428f12780004e1e9fce4722d88f909fd
	https://git.kernel.org/stable/c/fb8e8d58f116d069e5939e1f786ac84e7fa4533e
	https://git.kernel.org/stable/c/9b5a04ac3ad9898c4745cba46ea26de74ba56a8e