diff options
author | Andreas Gruenbacher <agruenba@redhat.com> | 2015-11-03 12:25:33 -0500 |
---|---|---|
committer | Trond Myklebust <trond.myklebust@primarydata.com> | 2015-11-03 12:33:04 -0500 |
commit | 1ca843a2d28dec89e58e7227c27a9d55f21f59e1 (patch) | |
tree | dfdc9c884722b86e88a152e213459bf6c80951ce | |
parent | 8fbcf237439f841e7e9c4675790e08ea1c295bd3 (diff) |
nfs: Fix GETATTR bitmap verification
When decoding GETATTR replies, the client checks the attribute bitmap
for which attributes the server has sent. It misses bits at the word
boundaries, though; fix that.
Signed-off-by: Andreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@primarydata.com>
-rw-r--r-- | fs/nfs/nfs4xdr.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 22a1ddd4fe96..dfed4f5c8fcc 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -4375,6 +4375,11 @@ static int decode_statfs(struct xdr_stream *xdr, struct nfs_fsstat *fsstat) | |||
4375 | goto xdr_error; | 4375 | goto xdr_error; |
4376 | if ((status = decode_attr_files_total(xdr, bitmap, &fsstat->tfiles)) != 0) | 4376 | if ((status = decode_attr_files_total(xdr, bitmap, &fsstat->tfiles)) != 0) |
4377 | goto xdr_error; | 4377 | goto xdr_error; |
4378 | |||
4379 | status = -EIO; | ||
4380 | if (unlikely(bitmap[0])) | ||
4381 | goto xdr_error; | ||
4382 | |||
4378 | if ((status = decode_attr_space_avail(xdr, bitmap, &fsstat->abytes)) != 0) | 4383 | if ((status = decode_attr_space_avail(xdr, bitmap, &fsstat->abytes)) != 0) |
4379 | goto xdr_error; | 4384 | goto xdr_error; |
4380 | if ((status = decode_attr_space_free(xdr, bitmap, &fsstat->fbytes)) != 0) | 4385 | if ((status = decode_attr_space_free(xdr, bitmap, &fsstat->fbytes)) != 0) |
@@ -4574,6 +4579,10 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap, | |||
4574 | goto xdr_error; | 4579 | goto xdr_error; |
4575 | fattr->valid |= status; | 4580 | fattr->valid |= status; |
4576 | 4581 | ||
4582 | status = -EIO; | ||
4583 | if (unlikely(bitmap[0])) | ||
4584 | goto xdr_error; | ||
4585 | |||
4577 | status = decode_attr_mode(xdr, bitmap, &fmode); | 4586 | status = decode_attr_mode(xdr, bitmap, &fmode); |
4578 | if (status < 0) | 4587 | if (status < 0) |
4579 | goto xdr_error; | 4588 | goto xdr_error; |
@@ -4627,6 +4636,10 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap, | |||
4627 | goto xdr_error; | 4636 | goto xdr_error; |
4628 | fattr->valid |= status; | 4637 | fattr->valid |= status; |
4629 | 4638 | ||
4639 | status = -EIO; | ||
4640 | if (unlikely(bitmap[1])) | ||
4641 | goto xdr_error; | ||
4642 | |||
4630 | status = decode_attr_mdsthreshold(xdr, bitmap, fattr->mdsthreshold); | 4643 | status = decode_attr_mdsthreshold(xdr, bitmap, fattr->mdsthreshold); |
4631 | if (status < 0) | 4644 | if (status < 0) |
4632 | goto xdr_error; | 4645 | goto xdr_error; |
@@ -4811,12 +4824,22 @@ static int decode_fsinfo(struct xdr_stream *xdr, struct nfs_fsinfo *fsinfo) | |||
4811 | if ((status = decode_attr_maxwrite(xdr, bitmap, &fsinfo->wtmax)) != 0) | 4824 | if ((status = decode_attr_maxwrite(xdr, bitmap, &fsinfo->wtmax)) != 0) |
4812 | goto xdr_error; | 4825 | goto xdr_error; |
4813 | fsinfo->wtpref = fsinfo->wtmax; | 4826 | fsinfo->wtpref = fsinfo->wtmax; |
4827 | |||
4828 | status = -EIO; | ||
4829 | if (unlikely(bitmap[0])) | ||
4830 | goto xdr_error; | ||
4831 | |||
4814 | status = decode_attr_time_delta(xdr, bitmap, &fsinfo->time_delta); | 4832 | status = decode_attr_time_delta(xdr, bitmap, &fsinfo->time_delta); |
4815 | if (status != 0) | 4833 | if (status != 0) |
4816 | goto xdr_error; | 4834 | goto xdr_error; |
4817 | status = decode_attr_pnfstype(xdr, bitmap, &fsinfo->layouttype); | 4835 | status = decode_attr_pnfstype(xdr, bitmap, &fsinfo->layouttype); |
4818 | if (status != 0) | 4836 | if (status != 0) |
4819 | goto xdr_error; | 4837 | goto xdr_error; |
4838 | |||
4839 | status = -EIO; | ||
4840 | if (unlikely(bitmap[1])) | ||
4841 | goto xdr_error; | ||
4842 | |||
4820 | status = decode_attr_layout_blksize(xdr, bitmap, &fsinfo->blksize); | 4843 | status = decode_attr_layout_blksize(xdr, bitmap, &fsinfo->blksize); |
4821 | if (status) | 4844 | if (status) |
4822 | goto xdr_error; | 4845 | goto xdr_error; |