vfio-ccw: Don't assume there are more ccws after a TIC
authorFarhan Ali <alifm@linux.ibm.com>
Mon, 21 Jan 2019 14:54:08 +0000 (09:54 -0500)
committerCornelia Huck <cohuck@redhat.com>
Mon, 4 Feb 2019 15:41:04 +0000 (16:41 +0100)
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 <alifm@linux.ibm.com>
Message-Id: <d63748c1f1b03147bcbf401596638627a5e35ef7.1548082107.git.alifm@linux.ibm.com>
Reviewed-by: Halil Pasic <pasic@linux.ibm.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
drivers/s390/cio/vfio_ccw_cp.c

index 70a006b..ba08fe1 100644 (file)
@@ -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++;