From: Farhan Ali Date: Mon, 21 Jan 2019 14:54:08 +0000 (-0500) Subject: vfio-ccw: Don't assume there are more ccws after a TIC X-Git-Url: http://git.cdn.openwrt.org/?a=commitdiff_plain;h=405d566f98ae19ccf624b31b6eccd6039d9cbc39;p=openwrt%2Fstaging%2Fblogic.git vfio-ccw: Don't assume there are more ccws after a TIC When trying to calculate the length of a ccw chain, we assume there are ccws after a TIC. This can lead to overcounting and copying garbage data from guest memory. Signed-off-by: Farhan Ali Message-Id: Reviewed-by: Halil Pasic Signed-off-by: Cornelia Huck --- diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c index 70a006ba4d05..ba08fe137c2e 100644 --- a/drivers/s390/cio/vfio_ccw_cp.c +++ b/drivers/s390/cio/vfio_ccw_cp.c @@ -392,7 +392,7 @@ static int ccwchain_calc_length(u64 iova, struct channel_program *cp) return -EOPNOTSUPP; } - if ((!ccw_is_chain(ccw)) && (!ccw_is_tic(ccw))) + if (!ccw_is_chain(ccw)) break; ccw++;