aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd
diff options
context:
space:
mode:
authorMi Jinlong <mijinlong@cn.fujitsu.com>2011-04-26 21:09:58 -0400
committerJ. Bruce Fields <bfields@redhat.com>2011-04-29 20:47:55 -0400
commit868b89c3dc25eec03985b31ff070e8f73c818980 (patch)
treef3ef1fc3c5d7414195af355fddd956d81fc81fc6 /fs/nfsd
parentb7c66360dc34e64742edabf4dc410070aa883119 (diff)
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: Mi Jinlong <mijinlong@cn.fujitsu.com> [bfields@redhat.com: use helper function] Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd')
-rw-r--r--fs/nfsd/nfs4state.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 6dbaa379c863..3196dc388578 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1724,6 +1724,13 @@ static void nfsd4_sequence_check_conn(struct nfsd4_conn *new, struct nfsd4_sessi
1724 return; 1724 return;
1725} 1725}
1726 1726
1727static bool nfsd4_session_too_many_ops(struct svc_rqst *rqstp, struct nfsd4_session *session)
1728{
1729 struct nfsd4_compoundargs *args = rqstp->rq_argp;
1730
1731 return args->opcnt > session->se_fchannel.maxops;
1732}
1733
1727__be32 1734__be32
1728nfsd4_sequence(struct svc_rqst *rqstp, 1735nfsd4_sequence(struct svc_rqst *rqstp,
1729 struct nfsd4_compound_state *cstate, 1736 struct nfsd4_compound_state *cstate,
@@ -1752,6 +1759,10 @@ nfsd4_sequence(struct svc_rqst *rqstp,
1752 if (!session) 1759 if (!session)
1753 goto out; 1760 goto out;
1754 1761
1762 status = nfserr_too_many_ops;
1763 if (nfsd4_session_too_many_ops(rqstp, session))
1764 goto out;
1765
1755 status = nfserr_badslot; 1766 status = nfserr_badslot;
1756 if (seq->slotid >= session->se_fchannel.maxreqs) 1767 if (seq->slotid >= session->se_fchannel.maxreqs)
1757 goto out; 1768 goto out;