aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorBryan Schumaker2013-04-19 15:09:38 -0500
committerGreg Kroah-Hartman2013-05-07 22:08:23 -0500
commita63d0364cc416e40a3a4f8d67d73354c91152a7d (patch)
treed2bd54924eea04d33b6d6d58e1925e1db14cafd3 /fs
parentf1b384b6f67be458dabb31ed1e5938e1b125f5f5 (diff)
downloadkernel-omap-a63d0364cc416e40a3a4f8d67d73354c91152a7d.tar.gz
kernel-omap-a63d0364cc416e40a3a4f8d67d73354c91152a7d.tar.xz
kernel-omap-a63d0364cc416e40a3a4f8d67d73354c91152a7d.zip
nfsd: Decode and send 64bit time values
commit bf8d909705e9d9bac31d9b8eac6734d2b51332a7 upstream. The seconds field of an nfstime4 structure is 64bit, but we are assuming that the first 32bits are zero-filled. So if the client tries to set atime to a value before the epoch (touch -t 196001010101), then the server will save the wrong value on disk. Signed-off-by: Bryan Schumaker <bjschuma@netapp.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs4xdr.c19
1 files changed, 5 insertions, 14 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index d1dd7100a556..cd5e6c155bcf 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -344,10 +344,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval,
344 all 32 bits of 'nseconds'. */ 344 all 32 bits of 'nseconds'. */
345 READ_BUF(12); 345 READ_BUF(12);
346 len += 12; 346 len += 12;
347 READ32(dummy32); 347 READ64(iattr->ia_atime.tv_sec);
348 if (dummy32)
349 return nfserr_inval;
350 READ32(iattr->ia_atime.tv_sec);
351 READ32(iattr->ia_atime.tv_nsec); 348 READ32(iattr->ia_atime.tv_nsec);
352 if (iattr->ia_atime.tv_nsec >= (u32)1000000000) 349 if (iattr->ia_atime.tv_nsec >= (u32)1000000000)
353 return nfserr_inval; 350 return nfserr_inval;
@@ -370,10 +367,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval,
370 all 32 bits of 'nseconds'. */ 367 all 32 bits of 'nseconds'. */
371 READ_BUF(12); 368 READ_BUF(12);
372 len += 12; 369 len += 12;
373 READ32(dummy32); 370 READ64(iattr->ia_mtime.tv_sec);
374 if (dummy32)
375 return nfserr_inval;
376 READ32(iattr->ia_mtime.tv_sec);
377 READ32(iattr->ia_mtime.tv_nsec); 371 READ32(iattr->ia_mtime.tv_nsec);
378 if (iattr->ia_mtime.tv_nsec >= (u32)1000000000) 372 if (iattr->ia_mtime.tv_nsec >= (u32)1000000000)
379 return nfserr_inval; 373 return nfserr_inval;
@@ -2386,8 +2380,7 @@ out_acl:
2386 if (bmval1 & FATTR4_WORD1_TIME_ACCESS) { 2380 if (bmval1 & FATTR4_WORD1_TIME_ACCESS) {
2387 if ((buflen -= 12) < 0) 2381 if ((buflen -= 12) < 0)
2388 goto out_resource; 2382 goto out_resource;
2389 WRITE32(0); 2383 WRITE64((s64)stat.atime.tv_sec);
2390 WRITE32(stat.atime.tv_sec);
2391 WRITE32(stat.atime.tv_nsec); 2384 WRITE32(stat.atime.tv_nsec);
2392 } 2385 }
2393 if (bmval1 & FATTR4_WORD1_TIME_DELTA) { 2386 if (bmval1 & FATTR4_WORD1_TIME_DELTA) {
@@ -2400,15 +2393,13 @@ out_acl:
2400 if (bmval1 & FATTR4_WORD1_TIME_METADATA) { 2393 if (bmval1 & FATTR4_WORD1_TIME_METADATA) {
2401 if ((buflen -= 12) < 0) 2394 if ((buflen -= 12) < 0)
2402 goto out_resource; 2395 goto out_resource;
2403 WRITE32(0); 2396 WRITE64((s64)stat.ctime.tv_sec);
2404 WRITE32(stat.ctime.tv_sec);
2405 WRITE32(stat.ctime.tv_nsec); 2397 WRITE32(stat.ctime.tv_nsec);
2406 } 2398 }
2407 if (bmval1 & FATTR4_WORD1_TIME_MODIFY) { 2399 if (bmval1 & FATTR4_WORD1_TIME_MODIFY) {
2408 if ((buflen -= 12) < 0) 2400 if ((buflen -= 12) < 0)
2409 goto out_resource; 2401 goto out_resource;
2410 WRITE32(0); 2402 WRITE64((s64)stat.mtime.tv_sec);
2411 WRITE32(stat.mtime.tv_sec);
2412 WRITE32(stat.mtime.tv_nsec); 2403 WRITE32(stat.mtime.tv_nsec);
2413 } 2404 }
2414 if (bmval1 & FATTR4_WORD1_MOUNTED_ON_FILEID) { 2405 if (bmval1 & FATTR4_WORD1_MOUNTED_ON_FILEID) {