SUNRPC: fix copying of multiple pages in gss_read_proxy_verf()
authorMartijn de Gouw <martijn.de.gouw@prodrive-technologies.com>
Mon, 19 Oct 2020 11:42:27 +0000 (13:42 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 30 Oct 2020 09:38:23 +0000 (10:38 +0100)
commitaf74b4a25fb2070c5061c29c1e07ee6b0d12ba84
tree0d8ae20884a4e472b71e42feb379e3b505886cad
parent707f8d0d380d7893cca2c6f196e0281b09db6d36
SUNRPC: fix copying of multiple pages in gss_read_proxy_verf()

[ Upstream commit d48c8124749c9a5081fe68680f83605e272c984b ]

When the passed token is longer than 4032 bytes, the remaining part
of the token must be copied from the rqstp->rq_arg.pages. But the
copy must make sure it happens in a consecutive way.

With the existing code, the first memcpy copies 'length' bytes from
argv->iobase, but since the header is in front, this never fills the
whole first page of in_token->pages.

The mecpy in the loop copies the following bytes, but starts writing at
the next page of in_token->pages.  This leaves the last bytes of page 0
unwritten.

Symptoms were that users with many groups were not able to access NFS
exports, when using Active Directory as the KDC.

Signed-off-by: Martijn de Gouw <martijn.de.gouw@prodrive-technologies.com>
Fixes: 5866efa8cbfb "SUNRPC: Fix svcauth_gss_proxy_init()"
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/sunrpc/auth_gss/svcauth_gss.c