diff options
-rw-r--r-- | fs/nfsd/nfs4xdr.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c index 059d4aad39b8..42f9fb661006 100644 --- a/fs/nfsd/nfs4xdr.c +++ b/fs/nfsd/nfs4xdr.c | |||
@@ -251,9 +251,14 @@ nfsd4_decode_bitmap(struct nfsd4_compoundargs *argp, u32 *bmval) | |||
251 | DECODE_TAIL; | 251 | DECODE_TAIL; |
252 | } | 252 | } |
253 | 253 | ||
254 | static u32 nfsd_attrmask[] = { | ||
255 | NFSD_WRITEABLE_ATTRS_WORD0, | ||
256 | NFSD_WRITEABLE_ATTRS_WORD1 | ||
257 | }; | ||
258 | |||
254 | static __be32 | 259 | static __be32 |
255 | nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *iattr, | 260 | nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, u32 *writable, |
256 | struct nfs4_acl **acl) | 261 | struct iattr *iattr, struct nfs4_acl **acl) |
257 | { | 262 | { |
258 | int expected_len, len = 0; | 263 | int expected_len, len = 0; |
259 | u32 dummy32; | 264 | u32 dummy32; |
@@ -271,7 +276,7 @@ nfsd4_decode_fattr(struct nfsd4_compoundargs *argp, u32 *bmval, struct iattr *ia | |||
271 | */ | 276 | */ |
272 | if ((bmval[0] & ~NFSD_SUPPORTED_ATTRS_WORD0) || (bmval[1] & ~NFSD_SUPPORTED_ATTRS_WORD1)) | 277 | if ((bmval[0] & ~NFSD_SUPPORTED_ATTRS_WORD0) || (bmval[1] & ~NFSD_SUPPORTED_ATTRS_WORD1)) |
273 | return nfserr_attrnotsupp; | 278 | return nfserr_attrnotsupp; |
274 | if ((bmval[0] & ~NFSD_WRITEABLE_ATTRS_WORD0) || (bmval[1] & ~NFSD_WRITEABLE_ATTRS_WORD1)) | 279 | if ((bmval[0] & ~writable[0]) || (bmval[1] & ~writable[1])) |
275 | return nfserr_inval; | 280 | return nfserr_inval; |
276 | 281 | ||
277 | READ_BUF(4); | 282 | READ_BUF(4); |
@@ -499,7 +504,9 @@ nfsd4_decode_create(struct nfsd4_compoundargs *argp, struct nfsd4_create *create | |||
499 | if ((status = check_filename(create->cr_name, create->cr_namelen, nfserr_inval))) | 504 | if ((status = check_filename(create->cr_name, create->cr_namelen, nfserr_inval))) |
500 | return status; | 505 | return status; |
501 | 506 | ||
502 | if ((status = nfsd4_decode_fattr(argp, create->cr_bmval, &create->cr_iattr, &create->cr_acl))) | 507 | status = nfsd4_decode_fattr(argp, create->cr_bmval, nfsd_attrmask, |
508 | &create->cr_iattr, &create->cr_acl); | ||
509 | if (status) | ||
503 | goto out; | 510 | goto out; |
504 | 511 | ||
505 | DECODE_TAIL; | 512 | DECODE_TAIL; |
@@ -660,7 +667,9 @@ nfsd4_decode_open(struct nfsd4_compoundargs *argp, struct nfsd4_open *open) | |||
660 | switch (open->op_createmode) { | 667 | switch (open->op_createmode) { |
661 | case NFS4_CREATE_UNCHECKED: | 668 | case NFS4_CREATE_UNCHECKED: |
662 | case NFS4_CREATE_GUARDED: | 669 | case NFS4_CREATE_GUARDED: |
663 | if ((status = nfsd4_decode_fattr(argp, open->op_bmval, &open->op_iattr, &open->op_acl))) | 670 | status = nfsd4_decode_fattr(argp, open->op_bmval, |
671 | nfsd_attrmask, &open->op_iattr, &open->op_acl); | ||
672 | if (status) | ||
664 | goto out; | 673 | goto out; |
665 | break; | 674 | break; |
666 | case NFS4_CREATE_EXCLUSIVE: | 675 | case NFS4_CREATE_EXCLUSIVE: |
@@ -859,7 +868,7 @@ nfsd4_decode_setattr(struct nfsd4_compoundargs *argp, struct nfsd4_setattr *seta | |||
859 | status = nfsd4_decode_stateid(argp, &setattr->sa_stateid); | 868 | status = nfsd4_decode_stateid(argp, &setattr->sa_stateid); |
860 | if (status) | 869 | if (status) |
861 | return status; | 870 | return status; |
862 | return nfsd4_decode_fattr(argp, setattr->sa_bmval, | 871 | return nfsd4_decode_fattr(argp, setattr->sa_bmval, nfsd_attrmask, |
863 | &setattr->sa_iattr, &setattr->sa_acl); | 872 | &setattr->sa_iattr, &setattr->sa_acl); |
864 | } | 873 | } |
865 | 874 | ||