linux/fs/lockd
Chuck Lever fa670101d8 lockd: Serialize block retries against host teardown
nlmsvc_grant_blocked() unlinks a block from nlm_blocked before it
retries the lock, then re-inserts it. nlmsvc_traverse_blocks() skips a
block that is not on nlm_blocked, so a teardown scan that runs during a
retry passes it by and the retry puts it back. The surviving block pins
its host. lockd warns that it could not shut down the host module, and
the host outlives its network namespace.

Hold the file's f_mutex across the retry, and extend the scan's hold
across its unlink, so a scan and a retry of the same file can no longer
interleave. Drop the mutex before releasing a block reference, since
the last put takes f_mutex. A retry that waited out a scan re-checks
under nlm_blocked_lock that its block is still queued and due.

Reported-by: sashiko-bot <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/patchset/20260819162247.2970703-1-cel@kernel.org?part=1
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Link: https://patch.msgid.link/20260822-lockd-retry-blocked-uaf-v3-2-761661eae60c@kernel.org
Signed-off-by: Chuck Lever <cel@kernel.org>
2026-10-04 21:15:29 -04:00
..
clnt4xdr.c lockd: Rename struct nlm_res to lockd_res 2026-06-09 16:32:59 -04:00
clntlock.c lockd: Rename struct nlm_lock to lockd_lock 2026-06-09 16:32:59 -04:00
clntproc.c lockd: fix NULL dereference on lockowner allocation failure 2026-08-17 09:02:08 -07:00
clntxdr.c lockd: Rename struct nlm_res to lockd_res 2026-06-09 16:32:59 -04:00
host.c lockd: Rename struct nlm_reboot to lockd_reboot 2026-06-09 16:32:59 -04:00
lockd.h lockd: fix swapped arguments in nlmsvc_match_ip() 2026-08-10 09:54:35 -04:00
Makefile lockd: Remove dead code from fs/lockd/xdr.c 2026-06-09 16:32:59 -04:00
mon.c lockd: Rename struct nlm_reboot to lockd_reboot 2026-06-09 16:32:59 -04:00
netlink.c
netlink.h
netns.h
nlm.h lockd: Make linux/lockd/nlm.h an internal header 2026-03-29 21:25:09 -04:00
nlm3xdr_gen.c xdrgen: Share void RPC procedure handlers across programs 2026-08-10 09:54:35 -04:00
nlm3xdr_gen.h xdrgen: Share void RPC procedure handlers across programs 2026-08-10 09:54:35 -04:00
nlm4xdr_gen.c xdrgen: Share void RPC procedure handlers across programs 2026-08-10 09:54:35 -04:00
nlm4xdr_gen.h xdrgen: Share void RPC procedure handlers across programs 2026-08-10 09:54:35 -04:00
procfs.c
procfs.h
share.h lockd: preserve multiple NLM_SHARE grants from the same owner 2026-08-10 09:54:35 -04:00
svc.c lockd: Switch linux/nfs.h to linux/nfs_fh.h 2026-10-04 21:15:29 -04:00
svc4proc.c sunrpc: remove unused svc_version vs_count field 2026-08-10 09:54:35 -04:00
svclock.c lockd: Serialize block retries against host teardown 2026-10-04 21:15:29 -04:00
svcproc.c sunrpc: remove unused svc_version vs_count field 2026-08-10 09:54:35 -04:00
svcshare.c lockd: preserve multiple NLM_SHARE grants from the same owner 2026-08-10 09:54:35 -04:00
svcsubs.c lockd: fix swapped arguments in nlmsvc_match_ip() 2026-08-10 09:54:35 -04:00
trace.c
trace.h lockd: Switch linux/nfs.h to linux/nfs_fh.h 2026-10-04 21:15:29 -04:00
xdr.h lockd: Switch linux/nfs.h to linux/nfs_fh.h 2026-10-04 21:15:29 -04:00