linux/fs/lockd
Chuck Lever 6e4c62caec lockd: Avoid hashing uninitialized bytes in nlm4svc_lookup_file()
file_hash() digests the first LOCKD_FH_HASH_SIZE bytes of
nfs_fh.data when bucketing nlm_files[], independent of fh.size.
Commit 3de744ee4e ("lockd: Use xdrgen XDR functions for the
NLMv4 TEST procedure") set .pc_argzero to zero for the converted
procedures and moved file-handle population into
nlm4svc_lookup_file(), which copies only xdr_lock->fh.len bytes
into lock->fh.data.

When an NLMv4 client presents a file handle shorter than
LOCKD_FH_HASH_SIZE, bytes fh.len..31 retain whatever the argument
buffer held from an earlier request.  The same wire handle then
hashes to different buckets across calls; nlm_lookup_file() misses
the existing nlm_file entry, and lock-state lookups fail.

Zero only the tail bytes that file_hash() would otherwise consume.
Handles of LOCKD_FH_HASH_SIZE or larger already populate every byte
that file_hash() reads.

Reported-by: Jeff Layton <jlayton@kernel.org>
Closes: https://lore.kernel.org/r/5229a9746d723a3f830120c0b966510f75badfc2.camel@kernel.org
Fixes: 3de744ee4e ("lockd: Use xdrgen XDR functions for the NLMv4 TEST procedure")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
2026-06-09 16:32:59 -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: Rename struct nlm_res to lockd_res 2026-06-09 16:32:59 -04: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: Avoid hashing uninitialized bytes in nlm4svc_lookup_file() 2026-06-09 16:32:59 -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 tools: ynl-gen: add regeneration comment 2025-11-25 19:20:42 -08:00
netlink.h tools: ynl-gen: add regeneration comment 2025-11-25 19:20:42 -08:00
netns.h lockd: add netlink control interface 2025-03-10 09:10:53 -04:00
nlm.h lockd: Make linux/lockd/nlm.h an internal header 2026-03-29 21:25:09 -04:00
nlm3xdr_gen.c Documentation: Add the RPC language description of NLM version 3 2026-06-09 16:32:59 -04:00
nlm3xdr_gen.h Documentation: Add the RPC language description of NLM version 3 2026-06-09 16:32:59 -04:00
nlm4xdr_gen.c Documentation: Add the RPC language description of NLM version 4 2026-03-29 21:25:09 -04:00
nlm4xdr_gen.h Documentation: Add the RPC language description of NLM version 4 2026-03-29 21:25:09 -04:00
procfs.c
procfs.h
share.h lockd: Rename struct nlm_share to lockd_share 2026-06-09 16:32:59 -04:00
svc.c lockd: Relocate svc_version definitions to XDR layer 2026-03-29 21:25:09 -04:00
svc4proc.c lockd: Avoid hashing uninitialized bytes in nlm4svc_lookup_file() 2026-06-09 16:32:59 -04:00
svclock.c lockd: Rename struct nlm_lock to lockd_lock 2026-06-09 16:32:59 -04:00
svcproc.c lockd: Unify cast_status 2026-06-09 16:32:59 -04:00
svcshare.c lockd: Rename struct nlm_share to lockd_share 2026-06-09 16:32:59 -04:00
svcsubs.c lockd: Avoid hashing uninitialized bytes in nlm4svc_lookup_file() 2026-06-09 16:32:59 -04:00
trace.c lockd: add some client-side tracepoints 2023-04-26 09:05:00 -04:00
trace.h lockd: Use xdrgen XDR functions for the NLMv3 GRANTED procedure 2026-06-09 16:32:59 -04:00
xdr.h lockd: Remove dead code from fs/lockd/xdr.c 2026-06-09 16:32:59 -04:00