Commit 1ca843a2 authored by Andreas Gruenbacher's avatar Andreas Gruenbacher Committed by Trond Myklebust

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: default avatarAndreas Gruenbacher <agruenba@redhat.com>
Signed-off-by: default avatarTrond Myklebust <trond.myklebust@primarydata.com>
parent 8fbcf237
...@@ -4375,6 +4375,11 @@ static int decode_statfs(struct xdr_stream *xdr, struct nfs_fsstat *fsstat) ...@@ -4375,6 +4375,11 @@ static int decode_statfs(struct xdr_stream *xdr, struct nfs_fsstat *fsstat)
goto xdr_error; goto xdr_error;
if ((status = decode_attr_files_total(xdr, bitmap, &fsstat->tfiles)) != 0) if ((status = decode_attr_files_total(xdr, bitmap, &fsstat->tfiles)) != 0)
goto xdr_error; goto xdr_error;
status = -EIO;
if (unlikely(bitmap[0]))
goto xdr_error;
if ((status = decode_attr_space_avail(xdr, bitmap, &fsstat->abytes)) != 0) if ((status = decode_attr_space_avail(xdr, bitmap, &fsstat->abytes)) != 0)
goto xdr_error; goto xdr_error;
if ((status = decode_attr_space_free(xdr, bitmap, &fsstat->fbytes)) != 0) 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,6 +4579,10 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap,
goto xdr_error; goto xdr_error;
fattr->valid |= status; fattr->valid |= status;
status = -EIO;
if (unlikely(bitmap[0]))
goto xdr_error;
status = decode_attr_mode(xdr, bitmap, &fmode); status = decode_attr_mode(xdr, bitmap, &fmode);
if (status < 0) if (status < 0)
goto xdr_error; goto xdr_error;
...@@ -4627,6 +4636,10 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap, ...@@ -4627,6 +4636,10 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap,
goto xdr_error; goto xdr_error;
fattr->valid |= status; fattr->valid |= status;
status = -EIO;
if (unlikely(bitmap[1]))
goto xdr_error;
status = decode_attr_mdsthreshold(xdr, bitmap, fattr->mdsthreshold); status = decode_attr_mdsthreshold(xdr, bitmap, fattr->mdsthreshold);
if (status < 0) if (status < 0)
goto xdr_error; goto xdr_error;
...@@ -4811,12 +4824,22 @@ static int decode_fsinfo(struct xdr_stream *xdr, struct nfs_fsinfo *fsinfo) ...@@ -4811,12 +4824,22 @@ static int decode_fsinfo(struct xdr_stream *xdr, struct nfs_fsinfo *fsinfo)
if ((status = decode_attr_maxwrite(xdr, bitmap, &fsinfo->wtmax)) != 0) if ((status = decode_attr_maxwrite(xdr, bitmap, &fsinfo->wtmax)) != 0)
goto xdr_error; goto xdr_error;
fsinfo->wtpref = fsinfo->wtmax; fsinfo->wtpref = fsinfo->wtmax;
status = -EIO;
if (unlikely(bitmap[0]))
goto xdr_error;
status = decode_attr_time_delta(xdr, bitmap, &fsinfo->time_delta); status = decode_attr_time_delta(xdr, bitmap, &fsinfo->time_delta);
if (status != 0) if (status != 0)
goto xdr_error; goto xdr_error;
status = decode_attr_pnfstype(xdr, bitmap, &fsinfo->layouttype); status = decode_attr_pnfstype(xdr, bitmap, &fsinfo->layouttype);
if (status != 0) if (status != 0)
goto xdr_error; goto xdr_error;
status = -EIO;
if (unlikely(bitmap[1]))
goto xdr_error;
status = decode_attr_layout_blksize(xdr, bitmap, &fsinfo->blksize); status = decode_attr_layout_blksize(xdr, bitmap, &fsinfo->blksize);
if (status) if (status)
goto xdr_error; goto xdr_error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment