mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-09-27 12:57:53 +00:00
NFS: Guard against READDIR loop when entry names exceed MAXNAMELEN
[ Upstream commitf67b55b658
] Commit64cfca85ba
asserts the only valid return values for nfs2/3_decode_dirent should not include -ENAMETOOLONG, but for a server that sends a filename3 which exceeds MAXNAMELEN in a READDIR response the client's behavior will be to endlessly retry the operation. We could map -ENAMETOOLONG into -EBADCOOKIE, but that would produce truncated listings without any error. The client should return an error for this case to clearly assert that the server implementation must be corrected. Fixes:64cfca85ba
("NFS: Return valid errors from nfs2/3_decode_dirent()") Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
parent
6d08bd22fa
commit
fdbc9637bf
2 changed files with 2 additions and 2 deletions
|
@ -949,7 +949,7 @@ int nfs2_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
|
|||
|
||||
error = decode_filename_inline(xdr, &entry->name, &entry->len);
|
||||
if (unlikely(error))
|
||||
return -EAGAIN;
|
||||
return error == -ENAMETOOLONG ? -ENAMETOOLONG : -EAGAIN;
|
||||
|
||||
/*
|
||||
* The type (size and byte order) of nfscookie isn't defined in
|
||||
|
|
|
@ -1991,7 +1991,7 @@ int nfs3_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
|
|||
|
||||
error = decode_inline_filename3(xdr, &entry->name, &entry->len);
|
||||
if (unlikely(error))
|
||||
return -EAGAIN;
|
||||
return error == -ENAMETOOLONG ? -ENAMETOOLONG : -EAGAIN;
|
||||
|
||||
error = decode_cookie3(xdr, &new_cookie);
|
||||
if (unlikely(error))
|
||||
|
|
Loading…
Reference in a new issue