diff options
Diffstat (limited to 'fs/nfsd/nfs4xdr.c')
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 46 |
1 files changed, 12 insertions, 34 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index ab005fc637e1..254e5b21b915 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -244,20 +244,8 @@ nfsd4_decode_bitmap(struct nfsd4_compoundargs *argp, u32 *bmval) | |||
244 | DECODE_TAIL; | 244 | DECODE_TAIL; |
245 | } | 245 | } |
246 | 246 | ||
247 | static u32 nfsd_attrmask[] = { | ||
248 | NFSD_WRITEABLE_ATTRS_WORD0, | ||
249 | NFSD_WRITEABLE_ATTRS_WORD1, | ||
250 | NFSD_WRITEABLE_ATTRS_WORD2 | ||
251 | }; | ||
252 | |||
253 | static u32 nfsd41_ex_attrmask[] = { | ||
254 | NFSD_SUPPATTR_EXCLCREAT_WORD0, | ||
255 | NFSD_SUPPATTR_EXCLCREAT_WORD1, | ||
256 | NFSD_SUPPATTR_EXCLCREAT_WORD2 | ||
257 | }; | ||
258 | |||
259 | static __be32 | 247 | static __be32 |
260 | nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, u32 *writable, | 248 | nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, |
261 | struct iattr *iattr, struct nfs4_acl **acl) | 249 | struct iattr *iattr, struct nfs4_acl **acl) |
262 | { | 250 | { |
263 | int expected_len, len = 0; | 251 | int expected_len, len = 0; |
@@ -270,18 +258,6 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, u32 *writable, | |||
270 | if ((status = nfsd4_decode_bitmap(argp, bmval))) | 258 | if ((status = nfsd4_decode_bitmap(argp, bmval))) |
271 | return status; | 259 | return status; |
272 | 260 | ||
273 | /* | ||
274 | * According to spec, unsupported attributes return ERR_ATTRNOTSUPP; | ||
275 | * read-only attributes return ERR_INVAL. | ||
276 | */ | ||
277 | if ((bmval[0] & ~nfsd_suppattrs0(argp->minorversion)) || | ||
278 | (bmval[1] & ~nfsd_suppattrs1(argp->minorversion)) || | ||
279 | (bmval[2] & ~nfsd_suppattrs2(argp->minorversion))) | ||
280 | return nfserr_attrnotsupp; | ||
281 | if ((bmval[0] & ~writable[0]) || (bmval[1] & ~writable[1]) || | ||
282 | (bmval[2] & ~writable[2])) | ||
283 | return nfserr_inval; | ||
284 | |||
285 | READ_BUF(4); | 261 | READ_BUF(4); |
286 | READ32(expected_len); | 262 | READ32(expected_len); |
287 | 263 | ||
@@ -414,8 +390,11 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, u32 *writable, | |||
414 | goto xdr_error; | 390 | goto xdr_error; |
415 | } | 391 | } |
416 | } | 392 | } |
417 | BUG_ON(bmval[2]); /* no such writeable attr supported yet */ | 393 | if (bmval[0] & ~NFSD_WRITEABLE_ATTRS_WORD0 |
418 | if (len != expected_len) | 394 | || bmval[1] & ~NFSD_WRITEABLE_ATTRS_WORD1 |
395 | || bmval[2] & ~NFSD_WRITEABLE_ATTRS_WORD2) | ||
396 | READ_BUF(expected_len - len); | ||
397 | else if (len != expected_len) | ||
419 | goto xdr_error; | 398 | goto xdr_error; |
420 | 399 | ||
421 | DECODE_TAIL; | 400 | DECODE_TAIL; |
@@ -508,8 +487,8 @@ nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create | |||
508 | if ((status = check_filename(create->cr_name, create->cr_namelen, nfserr_inval))) | 487 | if ((status = check_filename(create->cr_name, create->cr_namelen, nfserr_inval))) |
509 | return status; | 488 | return status; |
510 | 489 | ||
511 | status = nfsd4_decode_fattr(argp, create->cr_bmval, nfsd_attrmask, | 490 | status = nfsd4_decode_fattr(argp, create->cr_bmval, &create->cr_iattr, |
512 | &create->cr_iattr, &create->cr_acl); | 491 | &create->cr_acl); |
513 | if (status) | 492 | if (status) |
514 | goto out; | 493 | goto out; |
515 | 494 | ||
@@ -672,7 +651,7 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open) | |||
672 | case NFS4_CREATE_UNCHECKED: | 651 | case NFS4_CREATE_UNCHECKED: |
673 | case NFS4_CREATE_GUARDED: | 652 | case NFS4_CREATE_GUARDED: |
674 | status = nfsd4_decode_fattr(argp, open->op_bmval, | 653 | status = nfsd4_decode_fattr(argp, open->op_bmval, |
675 | nfsd_attrmask, &open->op_iattr, &open->op_acl); | 654 | &open->op_iattr, &open->op_acl); |
676 | if (status) | 655 | if (status) |
677 | goto out; | 656 | goto out; |
678 | break; | 657 | break; |
@@ -686,8 +665,7 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open) | |||
686 | READ_BUF(8); | 665 | READ_BUF(8); |
687 | COPYMEM(open->op_verf.data, 8); | 666 | COPYMEM(open->op_verf.data, 8); |
688 | status = nfsd4_decode_fattr(argp, open->op_bmval, | 667 | status = nfsd4_decode_fattr(argp, open->op_bmval, |
689 | nfsd41_ex_attrmask, &open->op_iattr, | 668 | &open->op_iattr, &open->op_acl); |
690 | &open->op_acl); | ||
691 | if (status) | 669 | if (status) |
692 | goto out; | 670 | goto out; |
693 | break; | 671 | break; |
@@ -883,8 +861,8 @@ nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *seta | |||
883 | status = nfsd4_decode_stateid(argp, &setattr->sa_stateid); | 861 | status = nfsd4_decode_stateid(argp, &setattr->sa_stateid); |
884 | if (status) | 862 | if (status) |
885 | return status; | 863 | return status; |
886 | return nfsd4_decode_fattr(argp, setattr->sa_bmval, nfsd_attrmask, | 864 | return nfsd4_decode_fattr(argp, setattr->sa_bmval, &setattr->sa_iattr, |
887 | &setattr->sa_iattr, &setattr->sa_acl); | 865 | &setattr->sa_acl); |
888 | } | 866 | } |
889 | 867 | ||
890 | static __be32 | 868 | static __be32 |