diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2023-01-08 17:28:42 +0100 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2023-02-20 15:20:24 +0100 |
commit | 15d8f80891bb4646ff213a9eae89732976396057 (patch) | |
tree | e1a7ad6f6fa653b1cc0dcd83e94d1242e003d9cb /net | |
parent | SUNRPC: Rename automatic variables in svcauth_gss_wrap_resp_integ() (diff) | |
download | linux-15d8f80891bb4646ff213a9eae89732976396057.tar.xz linux-15d8f80891bb4646ff213a9eae89732976396057.zip |
SUNRPC: Record gss_get_mic() errors in svcauth_gss_wrap_integ()
An error computing the checksum here is an exceptional event.
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/auth_gss/svcauth_gss.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c index e7076252dc01..8c4a44261919 100644 --- a/net/sunrpc/auth_gss/svcauth_gss.c +++ b/net/sunrpc/auth_gss/svcauth_gss.c @@ -1782,10 +1782,9 @@ static int svcauth_gss_wrap_integ(struct svc_rqst *rqstp) struct xdr_buf *buf = &rqstp->rq_res; struct xdr_buf databody_integ; struct xdr_netobj checksum; + u32 offset, len, maj_stat; struct kvec *resv; - u32 offset, len; __be32 *p; - int stat = -EINVAL; p = svcauth_gss_prepare_to_wrap(buf, gsd); if (p == NULL) @@ -1796,21 +1795,20 @@ static int svcauth_gss_wrap_integ(struct svc_rqst *rqstp) goto out; *p++ = htonl(len); *p++ = htonl(gc->gc_seq); - if (xdr_buf_subsegment(buf, &databody_integ, offset, len)) { - WARN_ON_ONCE(1); - goto out_err; - } + if (xdr_buf_subsegment(buf, &databody_integ, offset, len)) + goto wrap_failed; if (!buf->tail[0].iov_base) { if (buf->head[0].iov_len + RPC_MAX_AUTH_SIZE > PAGE_SIZE) - goto out_err; + goto wrap_failed; buf->tail[0].iov_base = buf->head[0].iov_base + buf->head[0].iov_len; buf->tail[0].iov_len = 0; } resv = &buf->tail[0]; checksum.data = (u8 *)resv->iov_base + resv->iov_len + 4; - if (gss_get_mic(gsd->rsci->mechctx, &databody_integ, &checksum)) - goto out_err; + maj_stat = gss_get_mic(gsd->rsci->mechctx, &databody_integ, &checksum); + if (maj_stat != GSS_S_COMPLETE) + goto bad_mic; svc_putnl(resv, checksum.len); memset(checksum.data + checksum.len, 0, round_up_to_quad(checksum.len) - checksum.len); @@ -1818,11 +1816,13 @@ static int svcauth_gss_wrap_integ(struct svc_rqst *rqstp) /* not strictly required: */ buf->len += XDR_QUADLEN(checksum.len) << 2; if (resv->iov_len > PAGE_SIZE) - goto out_err; + goto wrap_failed; out: - stat = 0; -out_err: - return stat; + return 0; +bad_mic: + trace_rpcgss_svc_get_mic(rqstp, maj_stat); +wrap_failed: + return -EINVAL; } static inline int |