]> www.infradead.org Git - users/willy/pagecache.git/commit
nfs: fix ->d_revalidate() UAF on ->d_name accesses
authorAl Viro <viro@zeniv.linux.org.uk>
Sun, 8 Dec 2024 06:27:11 +0000 (01:27 -0500)
committerAl Viro <viro@zeniv.linux.org.uk>
Tue, 28 Jan 2025 00:25:24 +0000 (19:25 -0500)
commitffeeaada2bddb88078f16ba24f24ce8651c22d5b
tree3d0d9a74f991c156cdd712f2afcad6b299c57dc8
parent39f644a26600634aee00f179ba42cbe5437fd04f
nfs: fix ->d_revalidate() UAF on ->d_name accesses

Pass the stable name all the way down to ->rpc_ops->lookup() instances.

Note that passing &dentry->d_name is safe in e.g. nfs_lookup() - it *is*
stable there, as it is in ->create() et.al.

dget_parent() in nfs_instantiate() should be redundant - it'd better be
stable there; if it's not, we have more trouble, since ->d_name would
also be unsafe in such case.

nfs_submount() and nfs4_submount() may or may not require fixes - if
they ever get moved on server with fhandle preserved, we are in trouble
there...

UAF window is fairly narrow here and exfiltration requires the ability
to watch the traffic.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/nfs/dir.c
fs/nfs/namespace.c
fs/nfs/nfs3proc.c
fs/nfs/nfs4proc.c
fs/nfs/proc.c
include/linux/nfs_xdr.h