In the Linux kernel, the following vulnerability has been resolved:
nfsd: fix layout fence worker double-reference race
The workqueue core clears WORK_STRUCT_PENDING before the callback
is invoked, so delayed_work_pending() in lm_breaker_timedout() can
return false while the fence worker is already running. This lets
the breaker take a duplicate sc_count reference and schedule a new
worker that coalesces with the in-progress one. The extra reference
is never put, leaking the layout stateid.
Replace the racy delayed_work_pending() check with an
ls_fence_inflight boolean set atomically with
refcount_inc_not_zero() under ls_lock, and cleared under ls_lock
before the final nfs4_put_stid() on the dispose path; the retry
path intentionally retains it. Remove the self-rearm
mod_delayed_work() at the top of the worker.
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 SCSI layout fencing (nfsd4_layout_lm_breaker_timedout → nfsd4_layout_fence_worker in fs/nfsd/nfs4layouts.c), reached over NFSv4.1 COMPOUND on TCP/2049: LAYOUTGET installs an FL_LAYOUT lease, then a conflicting OPEN/WRITE hits nfsd_open_break_lease → time_out_leases after recall timeout.
AC:L - The attacker controls both sides of the delayed_work_pending race: one client holds a SCSI layout and ignores CB_LAYOUTRECALL so the fence worker runs, while other attacker connections spam OPEN/WRITE so concurrent nfsd threads call lm_breaker_timedout while WORK_STRUCT_PENDING is already clear; the sequence is retryable.
PR:N - Typical nfsd exports accept AUTH_SYS/AUTH_NULL with no cryptographic RPC authentication; EXCHANGE_ID, CREATE_SESSION, OPEN, and LAYOUTGET succeed for any host permitted by the export, so a remote NFSv4.1 client needs no kernel-verified credentials or local account on the server.
UI:N - The attacker is the NFS client and sends LAYOUTGET plus conflicting OPEN/WRITE compounds against an already-running pNFS SCSI export; no victim user must mount a filesystem, open a file, or take any other action on the host.
S:U - Impact is kernel nfsd layout-stateid and nfs4_client lifetime on the NFS server host and does not cross a VM, hypervisor, sandbox, or IOMMU security boundary.
C:H - The unmatched sc_count leaves the nfs4_layout_stateid on nfs4_file.fi_lo_states without pinning nfs4_client; after that client is expired, a later LAYOUTGET walks the list and nfsd4_run_cb dereferences freed cb_clp, a use-after-free that can be reused for arbitrary kernel reads.
I:H - The same use-after-free of nfs4_client (cl_cb_session, cl_callback_wq, and nfsd4_callback_ops) from nfsd4_recall_file_layout → nfsd4_run_cb enables heap spraying and function-pointer hijack of the CB_LAYOUTRECALL work path.
A:H - Each won race permanently leaks a layout stateid (and can pin nfs4_client via cl_lo_states); repeating LAYOUTGET/fence races exhausts nfsd state and kernel memory, and the later nfs4_client use-after-free oopses or panics the nfsd thread.
| 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 SCSI layout fencing (nfsd4_layout_lm_breaker_timedout → nfsd4_layout_fence_worker in fs/nfsd/nfs4layouts.c), reached over NFSv4.1 COMPOUND on TCP/2049: LAYOUTGET installs an FL_LAYOUT lease, then a conflicting OPEN/WRITE hits nfsd_open_break_lease → time_out_leases after recall timeout.
AC:L - The attacker controls both sides of the delayed_work_pending race: one client holds a SCSI layout and ignores CB_LAYOUTRECALL so the fence worker runs, while other attacker connections spam OPEN/WRITE so concurrent nfsd threads call lm_breaker_timedout while WORK_STRUCT_PENDING is already clear; the sequence is retryable.
PR:N - Typical nfsd exports accept AUTH_SYS/AUTH_NULL with no cryptographic RPC authentication; EXCHANGE_ID, CREATE_SESSION, OPEN, and LAYOUTGET succeed for any host permitted by the export, so a remote NFSv4.1 client needs no kernel-verified credentials or local account on the server.
UI:N - The attacker is the NFS client and sends LAYOUTGET plus conflicting OPEN/WRITE compounds against an already-running pNFS SCSI export; no victim user must mount a filesystem, open a file, or take any other action on the host.
S:U - Impact is kernel nfsd layout-stateid and nfs4_client lifetime on the NFS server host and does not cross a VM, hypervisor, sandbox, or IOMMU security boundary.
C:H - The unmatched sc_count leaves the nfs4_layout_stateid on nfs4_file.fi_lo_states without pinning nfs4_client; after that client is expired, a later LAYOUTGET walks the list and nfsd4_run_cb dereferences freed cb_clp, a use-after-free that can be reused for arbitrary kernel reads.
I:H - The same use-after-free of nfs4_client (cl_cb_session, cl_callback_wq, and nfsd4_callback_ops) from nfsd4_recall_file_layout → nfsd4_run_cb enables heap spraying and function-pointer hijack of the CB_LAYOUTRECALL work path.
A:H - Each won race permanently leaks a layout stateid (and can pin nfs4_client via cl_lo_states); repeating LAYOUTGET/fence races exhausts nfsd state and kernel memory, and the later nfs4_client use-after-free oopses or panics the nfsd thread.
CVSS 3.1