summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2023-01-08 11:30:59 -0500
committerChuck Lever <chuck.lever@oracle.com>2023-02-20 09:20:31 -0500
commitcee4db19452467eef8ab93c6eb6a3a84d11d25d7 (patch)
tree369c16a9d71caf639cf108133938e6d5ca925ad7 /net
parent5df25676de2e13b2cb67140fd43bcbfdd60ef0df (diff)
downloadlinux-stable-cee4db19452467eef8ab93c6eb6a3a84d11d25d7.tar.gz
linux-stable-cee4db19452467eef8ab93c6eb6a3a84d11d25d7.tar.bz2
linux-stable-cee4db19452467eef8ab93c6eb6a3a84d11d25d7.zip
SUNRPC: Refactor RPC server dispatch method
Currently, svcauth_gss_accept() pre-reserves response buffer space for the RPC payload length and GSS sequence number before returning to the dispatcher, which then adds the header's accept_stat field. The problem is the accept_stat field is supposed to go before the length and seq_num fields. So svcauth_gss_release() has to relocate the accept_stat value (see svcauth_gss_prepare_to_wrap()). To enable these fields to be added to the response buffer in the correct (final) order, the pointer to the accept_stat has to be made available to svcauth_gss_accept() so that it can set it before reserving space for the length and seq_num fields. As a first step, move the pointer to the location of the accept_stat field into struct svc_rqst. 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/svc.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/net/sunrpc/svc.c b/net/sunrpc/svc.c
index 167cb928515f..16760bc5191f 100644
--- a/net/sunrpc/svc.c
+++ b/net/sunrpc/svc.c
@@ -1232,9 +1232,9 @@ svc_process_common(struct svc_rqst *rqstp)
const struct svc_procedure *procp = NULL;
struct svc_serv *serv = rqstp->rq_server;
struct svc_process_info process;
- __be32 *p, *statp;
int auth_res, rc;
unsigned int aoffset;
+ __be32 *p;
/* Will be turned off by GSS integrity and privacy services */
set_bit(RQ_SPLICE_OK, &rqstp->rq_flags);
@@ -1314,8 +1314,8 @@ svc_process_common(struct svc_rqst *rqstp)
trace_svc_process(rqstp, progp->pg_name);
aoffset = xdr_stream_pos(xdr);
- statp = xdr_reserve_space(&rqstp->rq_res_stream, XDR_UNIT);
- *statp = rpc_success;
+ rqstp->rq_accept_statp = xdr_reserve_space(&rqstp->rq_res_stream, XDR_UNIT);
+ *rqstp->rq_accept_statp = rpc_success;
/* un-reserve some of the out-queue now that we have a
* better idea of reply size
@@ -1324,7 +1324,7 @@ svc_process_common(struct svc_rqst *rqstp)
svc_reserve_auth(rqstp, procp->pc_xdrressize<<2);
/* Call the function that processes the request. */
- rc = process.dispatch(rqstp, statp);
+ rc = process.dispatch(rqstp);
if (procp->pc_release)
procp->pc_release(rqstp);
if (!rc)
@@ -1332,7 +1332,7 @@ svc_process_common(struct svc_rqst *rqstp)
if (rqstp->rq_auth_stat != rpc_auth_ok)
goto err_bad_auth;
- if (*statp != rpc_success)
+ if (*rqstp->rq_accept_statp != rpc_success)
xdr_truncate_encode(xdr, aoffset);
if (procp->pc_encode == NULL)