KernelScan.io

CRITICAL Introduced in 2.6.18

lockd TraverseFiles UAF

CVE-2026-89485

CVSS 9.8 / 10.0 NVD

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

KernelScan AI8.1HIGH

01

In the Linux kernel, the following vulnerability has been resolved: lockd: pin next file across nlm_inspect_file lock-drop nlm_traverse_files() pins the current file with f_count++ across a mutex_unlock for nlm_inspect_file(), but nothing pins the saved next pointer. A concurrent nlm_release_file() can kfree the next file during the unlock window, and the iterator dereferences freed memory on the next loop step. Pin both current and next before the lock-drop. Advance by swapping the pinned cursors at the end of each iteration so next is always held alive across the unlock. Always call nlm_file_release() after dropping the iteration pin, regardless of whether the file matched the predicate. Use nlm_file_inuse(), which does a live walk of the inode lock list, rather than the cached f_locks field, so skipped files that never ran nlm_inspect_file() are evaluated correctly. Because every file in a hash bucket is now pinned and released, files skipped by the is_failover_file predicate that have no locks, blocks, shares, or external references are deleted during traversal. The old code never evaluated skipped files for cleanup. The new behavior is intentional: such files are stale and should not persist in the table.

02

Engine v0.6.0

Risk summary

Products running an NFS server with lockd are at risk. A remote attacker who can reach the NFS/NLM service can trigger a use-after-free by racing file-release operations against the server's internal file traversal, potentially leading to kernel memory corruption, information disclosure, or a system crash. Exploitation requires precise timing of concurrent NFS lock operations but needs no local access or special privileges.

Affectedfs/lockd/svcsubs.c (lockd NFS lock manager)

Vulnerability analysis

The NFS lock manager's file traversal routine drops a mutex to inspect each file but only pins the current file's reference count, leaving the next file in the hash bucket unpinned. A concurrent file-release operation from another NFS client can free that next file during the unlock window, causing the iterator to dereference freed memory on the following loop step. The fix pins both the current and next files before dropping the mutex and advances by swapping the pinned cursors so the next entry is always held alive across the unlock; it also switches to a live lock-list check so skipped files are correctly evaluated for cleanup. This is reachable from any network client that can send NLM lock requests to the server — no local access or special privileges are required beyond reaching the NFS/NLM service, though exploitation requires winning a narrow race window.

03

BranchIntroducedFixed inPatch commit
5.152.6.185.15.22108a455f87b14
6.12.6.186.1.188550c19222c71
6.62.6.186.6.157350087f231c1
6.182.6.186.18.5041f0a6d31615
mainline2.6.187.3-rc1526c49cff3f7
6.122.6.186.12.109c24bdb7df2f3
5.102.6.185.10.270e3c413f789ea
7.22.6.187.2.4e999a8813365
cip/6.122.6.186.12.111-cip32c24bdb7df2f3