diff options
author | Benjamin Coddington <bcodding@redhat.com> | 2016-04-06 17:32:52 +0200 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2016-05-09 15:05:40 +0200 |
commit | 06ef26a0e35199cc0445d7d5708533a12af8ff5b (patch) | |
tree | d106311ccb86ee0ae30aeaf05565861f5d636017 /net/sunrpc | |
parent | NFS: Save struct inode * inside nfs_commit_info to clarify usage of i_lock (diff) | |
download | linux-06ef26a0e35199cc0445d7d5708533a12af8ff5b.tar.xz linux-06ef26a0e35199cc0445d7d5708533a12af8ff5b.zip |
SUNRPC: init xdr_stream for zero iov_len, page_len
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>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/xdr.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/sunrpc/xdr.c b/net/sunrpc/xdr.c index 6bdb3865212d..c4f3cc0c0775 100644 --- a/net/sunrpc/xdr.c +++ b/net/sunrpc/xdr.c @@ -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; |