CRITICAL Introduced in 4.8
nfsd LayoutGet OOB
CVE-2026-89674
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
KernelScan AI8.7HIGH
01Description
In the Linux kernel, the following vulnerability has been resolved: nfsd: fix XDR length calculation in nfsd4_ff_encode_layoutget The XDR buffer size calculation in nfsd4_ff_encode_layoutget() has multiple errors that can result in either an out-of-bounds write or leaking uninitialized kernel memory to the client: - fh_len doesn't account for XDR padding on the file handle data - uid and gid lengths use "8 + len" but xdr_encode_opaque() actually writes "4 + xdr_align_size(len)" bytes - ds_len omits the flags and stats_collect_hint fields (8 bytes), while len's header constant overestimates by 8 bytes -- these partially cancel but leave a net mismatch The worst case occurs with short strings (e.g. uid=0, gid=0 with an odd-sized file handle), where the function writes up to 5 bytes past the reserved XDR buffer. Conversely, when string lengths happen to be 4-byte aligned, the reservation is too large and stale buffer content is sent to the client. Fix this by breaking out every encoded field explicitly in the ds_len calculation, using xdr_align_size() for all variable-length opaque fields, and correcting the header constants.
02KernelScan AI Analysis
Risk summary
An NFS server with pNFS flex file exports enabled can be exploited by any network client with access to the export. The client can trigger an out-of-bounds heap write or cause uninitialized kernel memory to be leaked back to the client, potentially leading to kernel crashes or information disclosure.
Vulnerability analysis
The NFS server's pNFS flex file layout XDR encoder miscalculates the buffer size needed for the layout response, failing to account for XDR padding on variable-length opaque fields such as file handles and user/group name strings. When the calculated size is too small — typically with short strings and an odd-sized file handle — the encoder writes a few bytes past the reserved buffer into adjacent heap memory. When the calculated size is too large, stale uninitialized kernel memory from the buffer is included in the response sent to the client. The fix corrects the calculation by breaking out every encoded field explicitly and applying proper XDR alignment to all variable-length opaque data. The vulnerable path is reached when any NFS client issues a LAYOUTGET request against an export with pNFS flex files enabled; no special privileges are needed beyond access to the export.
Lifecycle
03Fix Versions
| Branch | Introduced | Fixed in | Patch commit |
|---|---|---|---|
| 5.10 | 4.8 | 5.10.270 | 3a7fd224df0f |
| 5.15 | 4.8 | 5.15.221 | 29e4478e2ed5 |
| 6.1 | 4.8 | 6.1.188 | 65a72b721943 |
| 6.18 | 4.8 | 6.18.50 | 0380129b1373 |
| mainline | 4.8 | 7.3-rc1 | f9868174af49 |
| 6.6 | 4.8 | 6.6.157 | bee826c00ac9 |
| 7.2 | 4.8 | 7.2.4 | c81cef6a805d |
| 6.12 | 4.8 | 6.12.109 | e7d9d23ecd91 |
| cip/6.12 | 4.8 | 6.12.111-cip32 | e7d9d23ecd91 |