Commit 868b89c3 authored by Mi Jinlong's avatar Mi Jinlong Committed by J. Bruce Fields

nfsd41: compare request's opcnt with session's maxops at nfsd4_sequence

Make sure nfs server errors out if request contains more ops
than channel allows.
Signed-off-by: default avatarMi Jinlong <mijinlong@cn.fujitsu.com>
[bfields@redhat.com: use helper function]
Signed-off-by: default avatarJ. Bruce Fields <bfields@redhat.com>
parent b7c66360
...@@ -1724,6 +1724,13 @@ static void nfsd4_sequence_check_conn(struct nfsd4_conn *new, struct nfsd4_sessi ...@@ -1724,6 +1724,13 @@ static void nfsd4_sequence_check_conn(struct nfsd4_conn *new, struct nfsd4_sessi
return; return;
} }
static bool nfsd4_session_too_many_ops(struct svc_rqst *rqstp, struct nfsd4_session *session)
{
struct nfsd4_compoundargs *args = rqstp->rq_argp;
return args->opcnt > session->se_fchannel.maxops;
}
__be32 __be32
nfsd4_sequence(struct svc_rqst *rqstp, nfsd4_sequence(struct svc_rqst *rqstp,
struct nfsd4_compound_state *cstate, struct nfsd4_compound_state *cstate,
...@@ -1752,6 +1759,10 @@ nfsd4_sequence(struct svc_rqst *rqstp, ...@@ -1752,6 +1759,10 @@ nfsd4_sequence(struct svc_rqst *rqstp,
if (!session) if (!session)
goto out; goto out;
status = nfserr_too_many_ops;
if (nfsd4_session_too_many_ops(rqstp, session))
goto out;
status = nfserr_badslot; status = nfserr_badslot;
if (seq->slotid >= session->se_fchannel.maxreqs) if (seq->slotid >= session->se_fchannel.maxreqs)
goto out; goto out;
......
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