nfsd4: fix test_stateid error reply encoding
authorJ. Bruce Fields <bfields@redhat.com>
Mon, 3 Feb 2014 21:31:42 +0000 (16:31 -0500)
committerJ. Bruce Fields <bfields@redhat.com>
Thu, 27 Mar 2014 20:31:39 +0000 (16:31 -0400)
If the entire operation fails then there's nothing to encode.

Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
fs/nfsd/nfs4xdr.c

index de7bc8f7c106a440d6e4cb0fe0110f83a44acce0..aa04a6a98bd5ae3f6ced9d1f6c564100743b9ca3 100644 (file)
@@ -3473,6 +3473,9 @@ nfsd4_encode_test_stateid(struct nfsd4_compoundres *resp, __be32 nfserr,
        struct nfsd4_test_stateid_id *stateid, *next;
        __be32 *p;
 
+       if (nfserr)
+               return nfserr;
+
        RESERVE_SPACE(4 + (4 * test_stateid->ts_num_ids));
        *p++ = htonl(test_stateid->ts_num_ids);