nfsd: nfsd4_spo_must_allow() must check this is a v4 compound request

commit 1244f0b2c3cecd3f349a877006e67c9492b41807 upstream.

If the request being processed is not a v4 compound request, then
examining the cstate can have undefined results.

This patch adds a check that the rpc procedure being executed
(rq_procinfo) is the NFSPROC4_COMPOUND procedure.

Reported-by: Olga Kornievskaia <okorniev@redhat.com>
Cc: stable@vger.kernel.org
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: NeilBrown <neil@brown.name>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
NeilBrown
2025-03-28 11:05:59 +11:00
committed by Greg Kroah-Hartman
parent f08689fe31
commit e7e943ddd1

View File

@@ -3580,7 +3580,8 @@ bool nfsd4_spo_must_allow(struct svc_rqst *rqstp)
struct nfs4_op_map *allow = &cstate->clp->cl_spo_must_allow; struct nfs4_op_map *allow = &cstate->clp->cl_spo_must_allow;
u32 opiter; u32 opiter;
if (!cstate->minorversion) if (rqstp->rq_procinfo != &nfsd_version4.vs_proc[NFSPROC4_COMPOUND] ||
cstate->minorversion == 0)
return false; return false;
if (cstate->spo_must_allowed) if (cstate->spo_must_allowed)