]> www.infradead.org Git - users/jedix/linux-maple.git/commit
vfio/pci: Fix unsigned comparison overflow
authorAlex Williamson <alex.williamson@redhat.com>
Mon, 22 Feb 2016 23:02:29 +0000 (16:02 -0700)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 16 Jun 2017 20:13:00 +0000 (16:13 -0400)
commite8d71e28686b7b8c5dfc0bf90ab59e459e91537d
tree053ad1f181e90c45de31779f8d8286a349fd7ba2
parentab1b2a71c145d1b63ff1f2cca59f6f5b674f1d46
vfio/pci: Fix unsigned comparison overflow

Signed versus unsigned comparisons are implicitly cast to unsigned,
which result in a couple possible overflows.  For instance (start +
count) might overflow and wrap, getting through our validation test.
Also when unwinding setup, -1 being compared as unsigned doesn't
produce the intended stop condition.  Fix both of these and also fix
vfio_msi_set_vector_signal() to validate parameters before using the
vector index, though none of the callers should pass bad indexes
anymore.

OraBug: 26223261
Reported-by: Eric Auger <eric.auger@linaro.org>
Reviewed-by: Eric Auger <eric.auger@linaro.org>
Tested-by: Eric Auger <eric.auger@linaro.org>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
(cherry picked from commit b95d9305e8cb8d432ca02da1b759fef59bc50ace)
Reviewed-by: Shannon Nelson <shannon.nelson@oracle.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
drivers/vfio/pci/vfio_pci_intrs.c