6.1-stable review patch. If anyone has any objections, please let me know. ------------------ From: Eric Farman [ Upstream commit 565bef268d75bf7df665bce6923a88cd0eb74592 ] The first IDAW in a list does not need to be on a 2K/4K boundary like all others, and so is read separately to accurately calculate the size of the buffer needed to read the full IDAL. Verify that the address found in the first IDAW is unchanged between reads, to ensure a consistent set of IDAWs being worked with. Fixes: 01aa26c672c0 ("s390/cio: Combine direct and indirect CCW paths") Cc: stable@vger.kernel.org Reviewed-by: Matthew Rosato Signed-off-by: Eric Farman Signed-off-by: Christian Borntraeger Signed-off-by: Sasha Levin --- drivers/s390/cio/vfio_ccw_cp.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c index 3a234cd20cfb0..96e8d5eb2a9f6 100644 --- a/drivers/s390/cio/vfio_ccw_cp.c +++ b/drivers/s390/cio/vfio_ccw_cp.c @@ -617,6 +617,13 @@ static int ccwchain_fetch_direct(struct ccwchain *chain, if (ret) goto out_unpin; + /* Unexpected mismatch from earlier read */ + if (idaws[0] != iova) { + pa->pa_nr = 0; + ret = -EINVAL; + goto out_unpin; + } + /* * Copy guest IDAWs into page_array, in case the memory they * occupy is not contiguous. -- 2.53.0