In the Linux kernel, the following vulnerability has been resolved:
nfsd: fix BUG_ON in nfsd4_alloc_layout_stateid on racing delegation revoke
nfsd4_alloc_layout_stateid reads fp->fi_deleg_file without holding
fi_lock when the parent stateid is a delegation. A concurrent delegation
revoke via the laundromat can clear fi_deleg_file under fi_lock, causing
nfsd_file_get() to return NULL and triggering the BUG_ON.
This race is client-reachable: two NFS clients can trigger it by having
one hold a delegation while another opens the same file to force a
recall. When the first client doesn't respond to the recall, the
laundromat revokes it. A concurrent LAYOUTGET from any client using the
delegation stateid hits the race window.
Fix this by taking fi_lock around the fi_deleg_file read in the
SC_TYPE_DELEG path, matching the locking discipline of the
find_any_file() arm, and replacing the BUG_ON with a graceful error
return that cleans up the partially-initialized layout stateid.
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
CVSS Score: 9.8
AV:N - The flaw is in nfsd pNFS LAYOUTGET (nfsd4_alloc_layout_stateid in fs/nfsd/nfs4layouts.c). A remote NFSv4.1 client reaches it over TCP/2049 via nfsd_dispatch to nfsd4_proc_compound to nfsd4_layoutget, so no local access to the NFS server is required.
AC:L - The attacker controls both sides of the race: one NFS client obtains a delegation while another OPENs the same file to force recall, then the first client withholds CB_RECALL and issues concurrent LAYOUTGET with the delegation stateid as the laundromat runs put_deleg_file. The sequence is retryable and can be timed using FATTR4_LEASE_TIME.
PR:N - Typical nfsd deployments accept AUTH_SYS/AUTH_NULL without cryptographic authentication. Any host allowed by the export ACL can EXCHANGE_ID/CREATE_SESSION, OPEN to receive a delegation, and LAYOUTGET; no local account or capability on the NFS server is required.
UI:N - The attacking NFS clients drive the OPEN, recall, and LAYOUTGET compounds themselves against an already-running nfsd export. No victim user action such as mounting a filesystem or opening a file on the server is required.
S:U - The unlocked fi_deleg_file load and resulting BUG_ON or nfsd_file use-after-free occur in kernel nfsd state on the NFS server host. Impact stays in that kernel security authority and does not cross a VM, IOMMU, or sandbox boundary.
C:H - put_deleg_file may drop the last nfsd_file ref and call_rcu-free it (KMEM_CACHE flags 0, not SLAB_TYPESAFE_BY_RCU) while LAYOUTGET still calls nfsd_file_get on the stale pointer. After slab reuse the layout stateid's nf_file can be leveraged for kernel information disclosure.
I:H - The same stale nfsd_file pointer is used for refcount_inc_not_zero and later nfsd4_layout_setlease/kernel_setlease on nf_file. Heap reuse of the nfsd_file slab enables an arbitrary write or control-flow hijack per kernel UAF scoring guidance.
A:H - When nfsd_file_get returns NULL the original code hits BUG_ON(!ls->ls_file), oopsing or panicking the nfsd thread. Even without that assertion, use-after-free of nfsd_file crashes nfsd, and the attacker can repeat LAYOUTGET to deny NFS service.
| Attack Vector |
Network |
Scope |
Unchanged |
| Attack Complexity |
Low |
Confidentiality Impact |
High |
| Privileges Required |
None |
Integrity Impact |
High |
| User Interaction |
None |
Availability Impact |
High |
AV:N - The flaw is in nfsd pNFS LAYOUTGET (nfsd4_alloc_layout_stateid in fs/nfsd/nfs4layouts.c). A remote NFSv4.1 client reaches it over TCP/2049 via nfsd_dispatch to nfsd4_proc_compound to nfsd4_layoutget, so no local access to the NFS server is required.
AC:L - The attacker controls both sides of the race: one NFS client obtains a delegation while another OPENs the same file to force recall, then the first client withholds CB_RECALL and issues concurrent LAYOUTGET with the delegation stateid as the laundromat runs put_deleg_file. The sequence is retryable and can be timed using FATTR4_LEASE_TIME.
PR:N - Typical nfsd deployments accept AUTH_SYS/AUTH_NULL without cryptographic authentication. Any host allowed by the export ACL can EXCHANGE_ID/CREATE_SESSION, OPEN to receive a delegation, and LAYOUTGET; no local account or capability on the NFS server is required.
UI:N - The attacking NFS clients drive the OPEN, recall, and LAYOUTGET compounds themselves against an already-running nfsd export. No victim user action such as mounting a filesystem or opening a file on the server is required.
S:U - The unlocked fi_deleg_file load and resulting BUG_ON or nfsd_file use-after-free occur in kernel nfsd state on the NFS server host. Impact stays in that kernel security authority and does not cross a VM, IOMMU, or sandbox boundary.
C:H - put_deleg_file may drop the last nfsd_file ref and call_rcu-free it (KMEM_CACHE flags 0, not SLAB_TYPESAFE_BY_RCU) while LAYOUTGET still calls nfsd_file_get on the stale pointer. After slab reuse the layout stateid's nf_file can be leveraged for kernel information disclosure.
I:H - The same stale nfsd_file pointer is used for refcount_inc_not_zero and later nfsd4_layout_setlease/kernel_setlease on nf_file. Heap reuse of the nfsd_file slab enables an arbitrary write or control-flow hijack per kernel UAF scoring guidance.
A:H - When nfsd_file_get returns NULL the original code hits BUG_ON(!ls->ls_file), oopsing or panicking the nfsd thread. Even without that assertion, use-after-free of nfsd_file crashes nfsd, and the attacker can repeat LAYOUTGET to deny NFS service.
CVSS 3.1