summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2023-01-08 19:29:01 +0300
committerChuck Lever <chuck.lever@oracle.com>2023-02-20 17:20:25 +0300
commit7b135c65bb4544a5a1f72573b11adbcfc8aade9b (patch)
tree9a307043f1acd1ad5b0c516d7dab57e57ee1eb6a
parent7702378ac4d4a3be6414408d274df92bdd078249 (diff)
downloadlinux-7b135c65bb4544a5a1f72573b11adbcfc8aade9b.tar.xz
SUNRPC: Rename automatic variables in svcauth_gss_wrap_resp_priv()
Clean up variable names to match the other unwrap and wrap functions. Additionally, the explicit type cast on @gsd in unnecessary; and @resbuf is renamed to match the variable naming in the unwrap functions. Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
-rw-r--r--net/sunrpc/auth_gss/svcauth_gss.c72
1 files changed, 42 insertions, 30 deletions
diff --git a/net/sunrpc/auth_gss/svcauth_gss.c b/net/sunrpc/auth_gss/svcauth_gss.c
index d72ec8d05883..78b4eeba5ddc 100644
--- a/net/sunrpc/auth_gss/svcauth_gss.c
+++ b/net/sunrpc/auth_gss/svcauth_gss.c
@@ -1817,24 +1817,35 @@ wrap_failed:
return -EINVAL;
}
-static inline int
-svcauth_gss_wrap_resp_priv(struct svc_rqst *rqstp)
+/*
+ * RFC 2203, Section 5.3.2.3
+ *
+ * struct rpc_gss_priv_data {
+ * opaque databody_priv<>
+ * };
+ *
+ * struct rpc_gss_data_t {
+ * unsigned int seq_num;
+ * proc_req_arg_t arg;
+ * };
+ */
+static int svcauth_gss_wrap_priv(struct svc_rqst *rqstp)
{
- struct gss_svc_data *gsd = (struct gss_svc_data *)rqstp->rq_auth_data;
+ struct gss_svc_data *gsd = rqstp->rq_auth_data;
struct rpc_gss_wire_cred *gc = &gsd->clcred;
- struct xdr_buf *resbuf = &rqstp->rq_res;
+ struct xdr_buf *buf = &rqstp->rq_res;
struct page **inpages = NULL;
- __be32 *p, *len;
+ __be32 *p, *lenp;
int offset;
int pad;
- p = svcauth_gss_prepare_to_wrap(resbuf, gsd);
+ p = svcauth_gss_prepare_to_wrap(buf, gsd);
if (p == NULL)
return 0;
- len = p++;
- offset = (u8 *)p - (u8 *)resbuf->head[0].iov_base;
+ lenp = p++;
+ offset = (u8 *)p - (u8 *)buf->head[0].iov_base;
*p++ = htonl(gc->gc_seq);
- inpages = resbuf->pages;
+ inpages = buf->pages;
/* XXX: Would be better to write some xdr helper functions for
* nfs{2,3,4}xdr.c that place the data right, instead of copying: */
@@ -1845,19 +1856,19 @@ svcauth_gss_wrap_resp_priv(struct svc_rqst *rqstp)
* there is RPC_MAX_AUTH_SIZE slack space available in
* both the head and tail.
*/
- if (resbuf->tail[0].iov_base) {
- if (resbuf->tail[0].iov_base >=
- resbuf->head[0].iov_base + PAGE_SIZE)
+ if (buf->tail[0].iov_base) {
+ if (buf->tail[0].iov_base >=
+ buf->head[0].iov_base + PAGE_SIZE)
return -EINVAL;
- if (resbuf->tail[0].iov_base < resbuf->head[0].iov_base)
+ if (buf->tail[0].iov_base < buf->head[0].iov_base)
return -EINVAL;
- if (resbuf->tail[0].iov_len + resbuf->head[0].iov_len
+ if (buf->tail[0].iov_len + buf->head[0].iov_len
+ 2 * RPC_MAX_AUTH_SIZE > PAGE_SIZE)
return -ENOMEM;
- memmove(resbuf->tail[0].iov_base + RPC_MAX_AUTH_SIZE,
- resbuf->tail[0].iov_base,
- resbuf->tail[0].iov_len);
- resbuf->tail[0].iov_base += RPC_MAX_AUTH_SIZE;
+ memmove(buf->tail[0].iov_base + RPC_MAX_AUTH_SIZE,
+ buf->tail[0].iov_base,
+ buf->tail[0].iov_len);
+ buf->tail[0].iov_base += RPC_MAX_AUTH_SIZE;
}
/*
* If there is no current tail data, make sure there is
@@ -1866,21 +1877,22 @@ svcauth_gss_wrap_resp_priv(struct svc_rqst *rqstp)
* is RPC_MAX_AUTH_SIZE slack space available in both the
* head and tail.
*/
- if (resbuf->tail[0].iov_base == NULL) {
- if (resbuf->head[0].iov_len + 2*RPC_MAX_AUTH_SIZE > PAGE_SIZE)
+ if (!buf->tail[0].iov_base) {
+ if (buf->head[0].iov_len + 2 * RPC_MAX_AUTH_SIZE > PAGE_SIZE)
return -ENOMEM;
- resbuf->tail[0].iov_base = resbuf->head[0].iov_base
- + resbuf->head[0].iov_len + RPC_MAX_AUTH_SIZE;
- resbuf->tail[0].iov_len = 0;
+ buf->tail[0].iov_base = buf->head[0].iov_base
+ + buf->head[0].iov_len + RPC_MAX_AUTH_SIZE;
+ buf->tail[0].iov_len = 0;
}
- if (gss_wrap(gsd->rsci->mechctx, offset, resbuf, inpages))
+ if (gss_wrap(gsd->rsci->mechctx, offset, buf, inpages))
return -ENOMEM;
- *len = htonl(resbuf->len - offset);
- pad = 3 - ((resbuf->len - offset - 1)&3);
- p = (__be32 *)(resbuf->tail[0].iov_base + resbuf->tail[0].iov_len);
+ *lenp = htonl(buf->len - offset);
+ pad = 3 - ((buf->len - offset - 1) & 3);
+ p = (__be32 *)(buf->tail[0].iov_base + buf->tail[0].iov_len);
memset(p, 0, pad);
- resbuf->tail[0].iov_len += pad;
- resbuf->len += pad;
+ buf->tail[0].iov_len += pad;
+ buf->len += pad;
+
return 0;
}
@@ -1922,7 +1934,7 @@ svcauth_gss_release(struct svc_rqst *rqstp)
goto out_err;
break;
case RPC_GSS_SVC_PRIVACY:
- stat = svcauth_gss_wrap_resp_priv(rqstp);
+ stat = svcauth_gss_wrap_priv(rqstp);
if (stat)
goto out_err;
break;