diff options
author | J. Bruce Fields <bfields@redhat.com> | 2017-04-06 22:36:31 -0400 |
---|---|---|
committer | J. Bruce Fields <bfields@redhat.com> | 2017-04-25 17:25:53 -0400 |
commit | 51f567777799c9d85a778302b9eb61cf15214a98 (patch) | |
tree | ee2eaef3db97b66bba958fc65ef519a6c4c922ab /include | |
parent | 13bf9fbff0e5e099e2b6f003a0ab8ae145436309 (diff) | |
download | linux-stable-51f567777799c9d85a778302b9eb61cf15214a98.tar.gz linux-stable-51f567777799c9d85a778302b9eb61cf15214a98.tar.bz2 linux-stable-51f567777799c9d85a778302b9eb61cf15214a98.zip |
nfsd: check for oversized NFSv2/v3 arguments
A client can append random data to the end of an NFSv2 or NFSv3 RPC call
without our complaining; we'll just stop parsing at the end of the
expected data and ignore the rest.
Encoded arguments and replies are stored together in an array of pages,
and if a call is too large it could leave inadequate space for the
reply. This is normally OK because NFS RPC's typically have either
short arguments and long replies (like READ) or long arguments and short
replies (like WRITE). But a client that sends an incorrectly long reply
can violate those assumptions. This was observed to cause crashes.
So, insist that the argument not be any longer than we expect.
Also, several operations increment rq_next_page in the decode routine
before checking the argument size, which can leave rq_next_page pointing
well past the end of the page array, causing trouble later in
svc_free_pages.
As followup we may also want to rewrite the encoding routines to check
more carefully that they aren't running off the end of the page array.
Reported-by: Tuomas Haanpää <thaan@synopsys.com>
Reported-by: Ari Kauppi <ari@synopsys.com>
Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/sunrpc/svc.h | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/include/linux/sunrpc/svc.h b/include/linux/sunrpc/svc.h index e770abeed32d..6ef19cf658b4 100644 --- a/include/linux/sunrpc/svc.h +++ b/include/linux/sunrpc/svc.h @@ -336,8 +336,7 @@ xdr_argsize_check(struct svc_rqst *rqstp, __be32 *p) { char *cp = (char *)p; struct kvec *vec = &rqstp->rq_arg.head[0]; - return cp >= (char*)vec->iov_base - && cp <= (char*)vec->iov_base + vec->iov_len; + return cp == (char *)vec->iov_base + vec->iov_len; } static inline int |