Commit 1d498df4 authored by NeilBrown's avatar NeilBrown Committed by Anna Schumaker

sunrpc: fix prog selection loop in svc_process_common

If the rq_prog is not in the list of programs, then we use the last
program in the list and we don't get the expected rpc_prog_unavail error
as the subsequent tests on 'progp' being NULL are ineffective.

We should only assign progp when we find the right program, and we
should initialize it to NULL
Reported-by: default avatarDan Carpenter <dan.carpenter@linaro.org>
Fixes: 86ab08be ("SUNRPC: replace program list with program array")
Signed-off-by: default avatarNeilBrown <neilb@suse.de>
Acked-by: default avatarChuck Lever <chuck.lever@oracle.com>
Signed-off-by: default avatarAnna Schumaker <anna.schumaker@oracle.com>
parent 37578c68
......@@ -1321,7 +1321,7 @@ static int
svc_process_common(struct svc_rqst *rqstp)
{
struct xdr_stream *xdr = &rqstp->rq_res_stream;
struct svc_program *progp;
struct svc_program *progp = NULL;
const struct svc_procedure *procp = NULL;
struct svc_serv *serv = rqstp->rq_server;
struct svc_process_info process;
......@@ -1351,13 +1351,10 @@ svc_process_common(struct svc_rqst *rqstp)
rqstp->rq_vers = be32_to_cpup(p++);
rqstp->rq_proc = be32_to_cpup(p);
for (pr = 0; pr < serv->sv_nprogs; pr++) {
for (pr = 0; pr < serv->sv_nprogs; pr++)
if (rqstp->rq_prog == serv->sv_programs[pr].pg_prog)
progp = &serv->sv_programs[pr];
if (rqstp->rq_prog == progp->pg_prog)
break;
}
/*
* Decode auth data, and add verifier to reply buffer.
* We do this before anything else in order to get a decent
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment