summaryrefslogtreecommitdiff
path: root/fs/nfs/nfs42xdr.c
diff options
context:
space:
mode:
authorTrond Myklebust <trond.myklebust@hammerspace.com>2020-12-08 07:40:04 -0500
committerTrond Myklebust <trond.myklebust@hammerspace.com>2020-12-14 06:51:07 -0500
commit5c4afe2ab624cb8156e987ff929e00632fb56aeb (patch)
tree3ec537c77f9ed9f002e1dfc663005598f37e38e8 /fs/nfs/nfs42xdr.c
parent1ee6310119a5b4460324111a8c4536054356b963 (diff)
NFSv4.2: decode_read_plus_data() must skip padding after data segment
All XDR opaque object sizes are 32-bit aligned, and a data segment is no exception. Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Diffstat (limited to 'fs/nfs/nfs42xdr.c')
-rw-r--r--fs/nfs/nfs42xdr.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/fs/nfs/nfs42xdr.c b/fs/nfs/nfs42xdr.c
index 1c21db640f4d..4c6bce3dbaeb 100644
--- a/fs/nfs/nfs42xdr.c
+++ b/fs/nfs/nfs42xdr.c
@@ -1038,7 +1038,9 @@ static int decode_read_plus_data(struct xdr_stream *xdr, struct nfs_pgio_res *re
p = xdr_decode_hyper(p, &offset);
count = be32_to_cpup(p);
- recvd = xdr_align_data(xdr, res->count, count);
+ recvd = xdr_align_data(xdr, res->count, xdr_align_size(count));
+ if (recvd > count)
+ recvd = count;
res->count += recvd;
if (count > recvd) {