NFSD: Fix NFSv3 SETATTR/CREATE's handling of large file sizes
PATCH 1/1 NFSD: Fix NFSv3 SETATTR/CREATE's handling of large file sizes
From: Chuck Lever <[email protected]>
[ Upstream commit a648fdeb7c0e17177a2280344d015dba3fbe3314 ]
iattr::ia_size is a loff_t, so these NFSv3 procedures must be careful to deal with incoming client size values that are larger than s64_max without corrupting the value.
Silently capping the value results in storing a different value than the client passed in which is unexpected behavior, so remove the min_t() check in decode_sattr3().
Note that RFC 1813 permits only the WRITE procedure to return NFS3ERR_FBIG. We believe that NFSv3 reference implementations also return NFS3ERR_FBIG when ia_size is too large.
[Larry: backport to 5.4.y. Minor conflict resolved due to missing commit 9cde9360d18d
NFSD: Update the SETATTR3args decoder to use struct xdr_stream]
--- fs/nfsd/nfs3xdr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
fs/nfsd/nfs3xdr.c +1 -1
@@ -122,7 +122,7 @@ decode_sattr3(__be32 *p, struct iattr *iap, struct user_namespace *userns) iap->ia_valid |=ATTR_SIZE ; p =xdr_decode_hyper (p, &newsize); - iap->ia_size =min_t (u64, newsize,NFS_OFFSET_MAX ); + iap->ia_size = newsize; }if ((tmp =ntohl (*p++)) ==1 ) {/* set to server time */ iap->ia_valid |=ATTR_ATIME ;
Signature · 1 line
2.46.0
Sasha Levin
maintainer[ Sasha's backport helper bot ]
Hi,
✅ All tests passed successfully. No issues detected. No action required from the submitter.
The upstream commit SHA1 provided is correct: a648fdeb7c0e17177a2280344d015dba3fbe3314
WARNING: Author mismatch between patch and upstream commit:
Backport author: Larry Bassel<[email protected]> Commit author: Chuck Lever<[email protected]>
Status in newer kernel trees:
6.15.y | Present (exact SHA1) 6.14.y | Present (exact SHA1) 6.12.y | Present (exact SHA1)
6.6.y | Present (exact SHA1)
6.1.y | Present (exact SHA1)
5.15.y | Present (different SHA1: 37f2d2cd8ead)
5.10.y | Present (different SHA1: a231ae6bb50e)
Note: The patch differs from the upstream commit:
---
1: a648fdeb7c0e1 < -: ------------- NFSD: Fix NFSv3 SETATTR/CREATE's handling of large file sizes -: ------------- > 1: 4ef4f5c0a5841 NFSD: Fix NFSv3 SETATTR/CREATE's handling of large file sizes
---
Results of testing on various branches:
| Branch | Patch Apply | Build Test | |---------------------------|-------------|------------| | stable/linux-5.4.y | Success | Success |