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)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 6 May 2014 14:51:42 +0000 (07:51 -0700)
commit 4c69d5855a16f7378648c5733632628fa10431db upstream.

Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfsd/nfs4proc.c

index 64198ed1d64a99db5525bb2ae6455787ce1987e4..b26aae3072bfbbd70f8201a1437a4fe8e3a3b702 100644 (file)
@@ -1245,6 +1245,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);
                }