]> git.baikalelectronics.ru Git - kernel.git/commit
vfio/type1: Fix unmap overflow off-by-one
authorAlex Williamson <alex.williamson@redhat.com>
Tue, 8 Jan 2019 05:13:22 +0000 (22:13 -0700)
committerAlex Williamson <alex.williamson@redhat.com>
Tue, 8 Jan 2019 16:31:28 +0000 (09:31 -0700)
commit57a44588f4f88cf1a253ee0cefed94b65a12caa1
treea67fd59017fdf486f854b627c1128675660d9b4d
parent293dd3d570b4c5716df026ad7d77f8f58e691f15
vfio/type1: Fix unmap overflow off-by-one

The below referenced commit adds a test for integer overflow, but in
doing so prevents the unmap ioctl from ever including the last page of
the address space.  Subtract one to compare to the last address of the
unmap to avoid the overflow and wrap-around.

Fixes: 04f1c420cd43 ("vfio/type1: silence integer overflow warning")
Link: https://bugzilla.redhat.com/show_bug.cgi?id=1662291
Cc: stable@vger.kernel.org # v4.15+
Reported-by: Pei Zhang <pezhang@redhat.com>
Debugged-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Dan Carpenter <dan.carpenter@oracle.com>
Reviewed-by: Peter Xu <peterx@redhat.com>
Tested-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
drivers/vfio/vfio_iommu_type1.c