Skip to contentSkip to conversation

CVE-2026-46078: erofs: fix the out-of-bounds nameoff handling for trailing dirents

DISCUSSION Greg Kroah-Hartman 1 participant 1 message May 27

lore
Share & tools
lore
#0 lore raw

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

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

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

erofs: fix the out-of-bounds nameoff handling for trailing dirents

Currently we already have boundary-checks for nameoffs, but the trailing dirents are special since the namelens are calculated with strnlen() with unchecked nameoffs.

If a crafted EROFS has a trailing dirent with nameoff >= maxsize, maxsize - nameoff can underflow, causing strnlen() to read past the directory block.

nameoff0 should also be verified to be a multiple of sizeof(struct erofs_dirent) as well [1].

[1] https://sashiko.dev/#/patchset/20260416063511.3173774-1-hsiangkao%40linux.alibaba.com

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

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

	Issue introduced in 4.19 with commit 3aa8ec716e52c02360457fa018296629b4d0becf and fixed in 6.6.140 with commit 222055e6b4063abd2d9e13c3d49bbd1724c50789
	Issue introduced in 4.19 with commit 3aa8ec716e52c02360457fa018296629b4d0becf and fixed in 6.12.86 with commit 48b27a955d22391c7f30169fa7b6b2e1977f1ce4
	Issue introduced in 4.19 with commit 3aa8ec716e52c02360457fa018296629b4d0becf and fixed in 6.18.27 with commit 8ebb951a284b7446e025afc7dc5e9516ef9a7214
	Issue introduced in 4.19 with commit 3aa8ec716e52c02360457fa018296629b4d0becf and fixed in 7.0.4 with commit 1d55445226c75ddd4e78b09b3e7d99109b28c366
	Issue introduced in 4.19 with commit 3aa8ec716e52c02360457fa018296629b4d0becf and fixed in 7.1-rc1 with commit d18a3b5d337fa412a38e776e6b4b857a58836575

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

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/erofs/dir.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/222055e6b4063abd2d9e13c3d49bbd1724c50789
	https://git.kernel.org/stable/c/48b27a955d22391c7f30169fa7b6b2e1977f1ce4
	https://git.kernel.org/stable/c/8ebb951a284b7446e025afc7dc5e9516ef9a7214
	https://git.kernel.org/stable/c/1d55445226c75ddd4e78b09b3e7d99109b28c366
	https://git.kernel.org/stable/c/d18a3b5d337fa412a38e776e6b4b857a58836575