linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/2 v2] nfsd41: check the size of request
@ 2011-07-02  9:02 Mi Jinlong
  2011-07-06 16:43 ` J. Bruce Fields
  0 siblings, 1 reply; 8+ messages in thread
From: Mi Jinlong @ 2011-07-02  9:02 UTC (permalink / raw)
  To: J. Bruce Fields; +Cc: NFS

This patch just check request's size when it consists SEQUENCE.

Signed-off-by: Mi Jinlong <mijinlong@cn.fujitsu.com>
---
 fs/nfsd/nfs4state.c |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index e98f3c2..17e30bf 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1736,6 +1736,21 @@ static bool nfsd4_session_too_many_ops(struct svc_rqst *rqstp, struct nfsd4_sess
 	return args->opcnt > session->se_fchannel.maxops;
 }
 
+static int nfsd4_check_request_size(struct nfsd4_compoundargs *args,
+				    struct nfsd4_session *session)
+{
+	struct xdr_buf *xb = &args->rqstp->rq_arg;
+
+	/* Only SEQUENCE operation */
+	if (args->opcnt == 1)
+		return 0;
+
+	if (xb->len > session->se_fchannel.maxreq_sz)
+		return nfserr_req_too_big;
+
+	return 0;
+}
+
 __be32
 nfsd4_sequence(struct svc_rqst *rqstp,
 	       struct nfsd4_compound_state *cstate,
@@ -1804,6 +1819,7 @@ nfsd4_sequence(struct svc_rqst *rqstp,
 	cstate->slot = slot;
 	cstate->session = session;
 
+	status = nfsd4_check_request_size(rqstp->rq_argp, session);
 out:
 	/* Hold a session reference until done processing the compound. */
 	if (cstate->session) {
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-07-14 14:51 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-02  9:02 [PATCH 2/2 v2] nfsd41: check the size of request Mi Jinlong
2011-07-06 16:43 ` J. Bruce Fields
2011-07-08  9:13   ` Mi Jinlong
2011-07-08 20:03     ` J. Bruce Fields
2011-07-09  2:19       ` [PATCH 2/2 v3] " Mi Jinlong
2011-07-13  0:25         ` J. Bruce Fields
2011-07-14  6:56           ` [PATCH 2/2 v4] " Mi Jinlong
2011-07-14 14:51             ` J. Bruce Fields

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).