]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
nfsd: check for oversized NFSv2/v3 arguments
authorJ. Bruce Fields <bfields@redhat.com>
Fri, 7 Apr 2017 02:36:31 +0000 (22:36 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Tue, 25 Apr 2017 21:25:53 +0000 (17:25 -0400)
commit51f567777799c9d85a778302b9eb61cf15214a98
treeee2eaef3db97b66bba958fc65ef519a6c4c922ab
parent13bf9fbff0e5e099e2b6f003a0ab8ae145436309
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>
fs/nfsd/nfs3xdr.c
fs/nfsd/nfsxdr.c
include/linux/sunrpc/svc.h