]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commitdiff
SUNRPC: init xdr_stream for zero iov_len, page_len
authorBenjamin Coddington <bcodding@redhat.com>
Wed, 6 Apr 2016 15:32:52 +0000 (11:32 -0400)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Mon, 9 May 2016 13:05:40 +0000 (09:05 -0400)
An xdr_buf with head[0].iov_len = 0 and page_len = 0 will cause
xdr_init_decode() to incorrectly setup the xdr_stream.  Specifically,
xdr->end is never initialized.

Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
net/sunrpc/xdr.c

index 6bdb3865212d2edee16454970e21903870fd5d18..c4f3cc0c07752e3fbbe8e72316f2203a065e1646 100644 (file)
@@ -797,6 +797,8 @@ void xdr_init_decode(struct xdr_stream *xdr, struct xdr_buf *buf, __be32 *p)
                xdr_set_iov(xdr, buf->head, buf->len);
        else if (buf->page_len != 0)
                xdr_set_page_base(xdr, 0, buf->len);
+       else
+               xdr_set_iov(xdr, buf->head, buf->len);
        if (p != NULL && p > xdr->p && xdr->end >= p) {
                xdr->nwords -= p - xdr->p;
                xdr->p = p;