Skip to contentSkip to conversation

CVE-2023-54140: nilfs2: fix WARNING in mark_buffer_dirty due to discarded buffer reuse

DISCUSSION Greg Kroah-Hartman 1 participant 1 message Dec 24, 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 WARNING in mark_buffer_dirty due to discarded buffer reuse

A syzbot stress test using a corrupted disk image reported that mark_buffer_dirty() called from __nilfs_mark_inode_dirty() or nilfs_palloc_commit_alloc_entry() may output a kernel warning, and can panic if the kernel is booted with panic_on_warn.

This is because nilfs2 keeps buffer pointers in local structures for some metadata and reuses them, but such buffers may be forcibly discarded by nilfs_clear_dirty_page() in some critical situations.

This issue is reported to appear after commit 28a65b49eb53 ("nilfs2: do not write dirty data after degenerating to read-only"), but the issue has potentially existed before.

Fix this issue by checking the uptodate flag when attempting to reuse an internally held buffer, and reloading the metadata instead of reusing the buffer if the flag was lost.

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

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

	Issue introduced in 3.10 with commit 8c26c4e2694a163d525976e804d81cd955bbb40c and fixed in 4.14.326 with commit 473795610594f261e98920f0945550314df36f07
	Issue introduced in 3.10 with commit 8c26c4e2694a163d525976e804d81cd955bbb40c and fixed in 4.19.295 with commit d95e403588738c7ec38f52b9f490b15e7745d393
	Issue introduced in 3.10 with commit 8c26c4e2694a163d525976e804d81cd955bbb40c and fixed in 5.4.257 with commit 99a73016a5e12a09586a96f998e91f9ea145cd00
	Issue introduced in 3.10 with commit 8c26c4e2694a163d525976e804d81cd955bbb40c and fixed in 5.10.195 with commit f1d637b63d8a27ac3386f186a694907f2717fc13
	Issue introduced in 3.10 with commit 8c26c4e2694a163d525976e804d81cd955bbb40c and fixed in 5.15.131 with commit b911bef132a06de01a745c6a24172d6db7216333
	Issue introduced in 3.10 with commit 8c26c4e2694a163d525976e804d81cd955bbb40c and fixed in 6.1.52 with commit 4da07e958bfda2d69d83db105780e8916e3ac02e
	Issue introduced in 3.10 with commit 8c26c4e2694a163d525976e804d81cd955bbb40c and fixed in 6.4.15 with commit 46c11be2dca295742a5508ea910a77f7733fb7f4
	Issue introduced in 3.10 with commit 8c26c4e2694a163d525976e804d81cd955bbb40c and fixed in 6.5.2 with commit b308b3eabc429649b5501d36290cea403fbd746c
	Issue introduced in 3.10 with commit 8c26c4e2694a163d525976e804d81cd955bbb40c and fixed in 6.6 with commit cdaac8e7e5a059f9b5e816cda257f08d0abffacd

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-54140

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/alloc.c
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/473795610594f261e98920f0945550314df36f07
	https://git.kernel.org/stable/c/d95e403588738c7ec38f52b9f490b15e7745d393
	https://git.kernel.org/stable/c/99a73016a5e12a09586a96f998e91f9ea145cd00
	https://git.kernel.org/stable/c/f1d637b63d8a27ac3386f186a694907f2717fc13
	https://git.kernel.org/stable/c/b911bef132a06de01a745c6a24172d6db7216333
	https://git.kernel.org/stable/c/4da07e958bfda2d69d83db105780e8916e3ac02e
	https://git.kernel.org/stable/c/46c11be2dca295742a5508ea910a77f7733fb7f4
	https://git.kernel.org/stable/c/b308b3eabc429649b5501d36290cea403fbd746c
	https://git.kernel.org/stable/c/cdaac8e7e5a059f9b5e816cda257f08d0abffacd