nfsd4: session needs room for following op to error out
authorJ. Bruce Fields <bfields@redhat.com>
Tue, 28 Jan 2014 21:01:04 +0000 (16:01 -0500)
committerJ. Bruce Fields <bfields@redhat.com>
Thu, 27 Mar 2014 20:30:59 +0000 (16:30 -0400)
Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4proc.c

index 82189b208af31700418217e62d8339f13dce6565..b9048e5e349edfff712eb36756fbb2aeb4a318bb 100644 (file)
@@ -1359,6 +1359,12 @@ nfsd4_proc_compound(struct svc_rqst *rqstp,
                /* If op is non-idempotent */
                if (opdesc->op_flags & OP_MODIFIES_SOMETHING) {
                        plen = opdesc->op_rsize_bop(rqstp, op);
+                       /*
+                        * If there's still another operation, make sure
+                        * we'll have space to at least encode an error:
+                        */
+                       if (resp->opcnt < args->opcnt)
+                               plen += COMPOUND_ERR_SLACK_SPACE;
                        op->status = nfsd4_check_resp_size(resp, plen);
                }