CVE-2026-139510

nilfs2: fix link count underflow when removing corrupted directory

Published Nov 30, 2026 CVSS n/a EPSS n/a KEV · Not listed
Description
In the Linux kernel, the following vulnerability has been resolved:

nilfs2: fix link count underflow when removing corrupted directory

When removing an empty directory with a corrupted link count (e.g.,
i_nlink is 1 due to filesystem corruption), nilfs_rmdir() calls
drop_nlink() via nilfs_do_unlink() and then calls drop_nlink() again
on the directory inode. This second call causes an underflow of
i_nlink, triggering a kernel WARNING in drop_nlink().

Fix this issue by using clear_nlink() instead of drop_nlink() to
finalize the link count reset for the target directory in nilfs_rmdir().
Additionally, log a warning message when i_nlink is not 2 before
removing an empty directory to notify about the link count inconsistency.

Analysis

AI-generated

Technical impact

The flaw resides in the nilfs2 filesystem of the Linux kernel. When an empty directory whose link count has become corrupted (i.e., i_nlink is 1 instead of the expected 2) is removed, the code path calls drop_nlink() twice: first via nilfs_do_unlink() and then directly on the inode. The second call causes the inode’s link count to underflow, which triggers a kernel warning in the drop_nlink() routine. This underflow can bring the kernel into an invalid state, potentially leading to a crash if the warning propagates to a BUG or a panic. The root cause is an integer underflow caused by improper handling of corrupted metadata.

Affected Systems

All Linux kernel builds that include the nilfs2 filesystem driver are affected. No version range restriction is provided in the advisory; the issue exists in every kernel that contains the vulnerable code path until the upstream patch is applied. Administrators of systems running nilfs2 filesystems should consider the kernel vulnerable if the filesystem may contain corrupted directories.

Risk and Exploitability

The vulnerability likely requires local access with the ability to cause or introduce filesystem corruption, such as privileged users who can format or manipulate nilfs2 volumes. The attack vector is inferred to be local and involves creating a corrupted directory that triggers the double decrement during removal. Because no EPSS score is published and the issue is not listed in the CISA KEV catalog, the probability of exploitation is uncertain, although the potential impact—instability or panic of a kernel process—remains significant.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Apply the upstream kernel update that replaces drop_nlink() with clear_nlink() and adds a consistency check for i_nlink before removing directories.
  • Run a nilfs2 filesystem consistency check (e.g., fsck.nilfs2) on all nilfs2 volumes to identify and correct corrupted link counts, reducing the likelihood of an underflow trigger.
  • Upgrade to a kernel version that incorporates the nilfs2 fix or migrate the data to a different filesystem if immediate kernel updates cannot be deployed.

Generated by OpenCVE AI on December 1, 2026 at 06:22 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Weaknesses CWE-190
Type Values Removed Values Added
Description In the Linux kernel, the following vulnerability has been resolved: nilfs2: fix link count underflow when removing corrupted directory When removing an empty directory with a corrupted link count (e.g., i_nlink is 1 due to filesystem corruption), nilfs_rmdir() calls drop_nlink() via nilfs_do_unlink() and then calls drop_nlink() again on the directory inode. This second call causes an underflow of i_nlink, triggering a kernel WARNING in drop_nlink(). Fix this issue by using clear_nlink() instead of drop_nlink() to finalize the link count reset for the target directory in nilfs_rmdir(). Additionally, log a warning message when i_nlink is not 2 before removing an empty directory to notify about the link count inconsistency.
Title nilfs2: fix link count underflow when removing corrupted directory
First Time appeared Linux
Linux linux Kernel
CPEs cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
Vendors & Products Linux
Linux linux Kernel
References
Weaknesses
  • CWE-190

    Integer Overflow or Wraparound

Sources

Status
PUBLISHED
Assigner
Linux
Published
Updated
Nov 30, 2026, 1:35 PM
Reserved
Nov 30, 2026, 1:22 PM
Status
Received
Published
Nov 30, 2026, 2:19 PM
Modified
Nov 30, 2026, 2:19 PM