mirror of
https://github.com/rd-stuffs/msm-4.14.git
synced 2025-02-20 11:45:48 +08:00
SUNRPC: Properly set the @subbuf parameter of xdr_buf_subsegment()
commit 89a3c9f5b9f0bcaa9aea3e8b2a616fcaea9aad78 upstream. @subbuf is an output parameter of xdr_buf_subsegment(). A survey of call sites shows that @subbuf is always uninitialized before xdr_buf_segment() is invoked by callers. There are some execution paths through xdr_buf_subsegment() that do not set all of the fields in @subbuf, leaving some pointer fields containing garbage addresses. Subsequent processing of that buffer then results in a page fault. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Cc: <stable@vger.kernel.org> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
bbffca92d1
commit
653db17384
@ -1036,6 +1036,7 @@ xdr_buf_subsegment(struct xdr_buf *buf, struct xdr_buf *subbuf,
|
||||
base = 0;
|
||||
} else {
|
||||
base -= buf->head[0].iov_len;
|
||||
subbuf->head[0].iov_base = buf->head[0].iov_base;
|
||||
subbuf->head[0].iov_len = 0;
|
||||
}
|
||||
|
||||
@ -1048,6 +1049,8 @@ xdr_buf_subsegment(struct xdr_buf *buf, struct xdr_buf *subbuf,
|
||||
base = 0;
|
||||
} else {
|
||||
base -= buf->page_len;
|
||||
subbuf->pages = buf->pages;
|
||||
subbuf->page_base = 0;
|
||||
subbuf->page_len = 0;
|
||||
}
|
||||
|
||||
@ -1059,6 +1062,7 @@ xdr_buf_subsegment(struct xdr_buf *buf, struct xdr_buf *subbuf,
|
||||
base = 0;
|
||||
} else {
|
||||
base -= buf->tail[0].iov_len;
|
||||
subbuf->tail[0].iov_base = buf->tail[0].iov_base;
|
||||
subbuf->tail[0].iov_len = 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user