SUNRPC: Fix GSS privacy computation of auth->au_ralign
authorChuck Lever <chuck.lever@oracle.com>
Sat, 18 Apr 2020 18:38:19 +0000 (14:38 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 27 Apr 2020 14:58:30 +0000 (10:58 -0400)
commita7e429a6fa6d612d1dacde96c885dc1bb4a9f400
tree6806da98b5a7441ae94f7e70da7e34d5c2d299f7
parent31c9590ae468478fe47dc0f5f0d3562b2f69450e
SUNRPC: Fix GSS privacy computation of auth->au_ralign

When the au_ralign field was added to gss_unwrap_resp_priv, the
wrong calculation was used. Setting au_rslack == au_ralign is
probably correct for kerberos_v1 privacy, but kerberos_v2 privacy
adds additional GSS data after the clear text RPC message.
au_ralign needs to be smaller than au_rslack in that fairly common
case.

When xdr_buf_trim() is restored to gss_unwrap_kerberos_v2(), it does
exactly what I feared it would: it trims off part of the clear text
RPC message. However, that's because rpc_prepare_reply_pages() does
not set up the rq_rcv_buf's tail correctly because au_ralign is too
large.

Fixing the au_ralign computation also corrects the alignment of
rq_rcv_buf->pages so that the client does not have to shift reply
data payloads after they are received.

Fixes: 35e77d21baa0 ("SUNRPC: Add rpc_auth::au_ralign field")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
include/linux/sunrpc/gss_api.h
net/sunrpc/auth_gss/auth_gss.c
net/sunrpc/auth_gss/gss_krb5_wrap.c