nfsd4: fix xdr4 count of server in fs_location4
authorBenjamin Coddington <bcodding@redhat.com>
Sun, 7 Dec 2014 21:05:48 +0000 (16:05 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 16 Jan 2015 14:59:53 +0000 (06:59 -0800)
commit bf7491f1be5e125eece2ec67e0f79d513caa6c7e upstream.

Fix a bug where nfsd4_encode_components_esc() incorrectly calculates the
length of server array in fs_location4--note that it is a count of the
number of array elements, not a length in bytes.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Fixes: 082d4bd72a45 (nfsd4: "backfill" using write_bytes_to_xdr_buf)
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfsd/nfs4xdr.c

index 6c92a53964fd0afe36f30727b21f28266e46991c..2a77603d7cfd62d806f4d70f78e0405d5ecfe83b 100644 (file)
@@ -1800,7 +1800,7 @@ static __be32 nfsd4_encode_components_esc(struct xdr_stream *xdr, char sep,
 
                str = end;
        }
-       pathlen = htonl(xdr->buf->len - pathlen_offset);
+       pathlen = htonl(count);
        write_bytes_to_xdr_buf(xdr->buf, pathlen_offset, &pathlen, 4);
        return 0;
 }