]> www.infradead.org Git - users/dwmw2/linux.git/commit
NFS: abort nfs_atomic_open_v23 if name is too long.
authorNeilBrown <neilb@suse.de>
Tue, 28 May 2024 23:11:36 +0000 (09:11 +1000)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Thu, 30 May 2024 20:12:11 +0000 (16:12 -0400)
commit296f4ce81d08e73c22408c49f4938a85bd075e5c
treee2d91022a7ea26069219b0dc4a547e0e7b5877e3
parent0c8c7c559740d2d8b66048162af6c4dba8f0c88c
NFS: abort nfs_atomic_open_v23 if name is too long.

An attempt to open a file with a name longer than NFS3_MAXNAMLEN will
trigger a WARN_ON_ONCE in encode_filename3() because
nfs_atomic_open_v23() doesn't have the test on ->d_name.len that
nfs_atomic_open() has.

So add that test.

Reported-by: James Clark <james.clark@arm.com>
Closes: https://lore.kernel.org/all/20240528105249.69200-1-james.clark@arm.com/
Fixes: 7c6c5249f061 ("NFS: add atomic_open for NFSv3 to handle O_TRUNC correctly.")
Signed-off-by: NeilBrown <neilb@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/dir.c