Skip to content

Commit

Permalink
SUNRPC: init xdr_stream for zero iov_len, page_len
Browse files Browse the repository at this point in the history
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 <[email protected]>
Signed-off-by: Anna Schumaker <[email protected]>
  • Loading branch information
Benjamin Coddington authored and amschuma-ntap committed May 9, 2016
1 parent fe238e6 commit 06ef26a
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions net/sunrpc/xdr.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 06ef26a

Please sign in to comment.