summaryrefslogtreecommitdiff
path: root/fs/nfsd
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2014-03-12 01:58:57 +0400
committerJ. Bruce Fields <bfields@redhat.com>2014-05-31 01:31:59 +0400
commit89ff884ebbd0a667253dd61ade8a0e70b787c84a (patch)
tree83e49e034c99c8821fafa064e033837c46c15f82 /fs/nfsd
parent6ff9897d2bcf4036dfd139caeddd6f0a51c9ca06 (diff)
downloadlinux-89ff884ebbd0a667253dd61ade8a0e70b787c84a.tar.xz
nfsd4: nfsd4_check_resp_size should check against whole buffer
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4xdr.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 8ce6c8d5ee8a..0eeba2199c8c 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -3762,7 +3762,6 @@ __be32 nfsd4_check_resp_size(struct nfsd4_compoundres *resp, u32 respsize)
{
struct xdr_buf *buf = &resp->rqstp->rq_res;
struct nfsd4_session *session = resp->cstate.session;
- int slack_bytes = (char *)resp->xdr.end - (char *)resp->xdr.p;
if (nfsd4_has_session(&resp->cstate)) {
struct nfsd4_slot *slot = resp->cstate.slot;
@@ -3775,7 +3774,7 @@ __be32 nfsd4_check_resp_size(struct nfsd4_compoundres *resp, u32 respsize)
return nfserr_rep_too_big_to_cache;
}
- if (respsize > slack_bytes) {
+ if (buf->len + respsize > buf->buflen) {
WARN_ON_ONCE(nfsd4_has_session(&resp->cstate));
return nfserr_resource;
}