vfio/pci: Add missing range check in vfio_pci_mmap
authorChristian A. Ehrhardt <lk@c--e.de>
Mon, 12 Apr 2021 21:41:24 +0000 (23:41 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 21 Apr 2021 11:00:55 +0000 (13:00 +0200)
commitf66d695c06f4d788e1ff01778e4e72f8d19474de
treee4e68c06288cd1733f9b218652304c0130d0e29b
parente6177990e17d0b8126701fc8db877bc921caea16
vfio/pci: Add missing range check in vfio_pci_mmap

commit 909290786ea335366e21d7f1ed5812b90f2f0a92 upstream.

When mmaping an extra device region verify that the region index
derived from the mmap offset is valid.

Fixes: a15b1883fee1 ("vfio_pci: Allow mapping extra regions")
Cc: stable@vger.kernel.org
Signed-off-by: Christian A. Ehrhardt <lk@c--e.de>
Message-Id: <20210412214124.GA241759@lisa.in-ulm.de>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Cornelia Huck <cohuck@redhat.com>
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/vfio/pci/vfio_pci.c