]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
vfio/pci: Fix NULL pointer oops in error interrupt setup handling
authorAlex Williamson <alex.williamson@redhat.com>
Mon, 8 Aug 2016 22:16:23 +0000 (16:16 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Sep 2016 06:34:44 +0000 (08:34 +0200)
commit71a3276e1a96b5df1bdc3ccaf9cba0f874004dcb
treee63959f26c1b7ce9f627bfb2a657054038e821aa
parente6279bc952372fe47a06e13a1f7be34711854fd5
vfio/pci: Fix NULL pointer oops in error interrupt setup handling

commit c8952a707556e04374d7b2fdb3a079d63ddf6f2f upstream.

There are multiple cases in vfio_pci_set_ctx_trigger_single() where
we assume we can safely read from our data pointer without actually
checking whether the user has passed any data via the count field.
VFIO_IRQ_SET_DATA_NONE in particular is entirely broken since we
attempt to pull an int32_t file descriptor out before even checking
the data type.  The other data types assume the data pointer contains
one element of their type as well.

In part this is good news because we were previously restricted from
doing much sanitization of parameters because it was missed in the
past and we didn't want to break existing users.  Clearly DATA_NONE
is completely broken, so it must not have any users and we can fix
it up completely.  For DATA_BOOL and DATA_EVENTFD, we'll just
protect ourselves, returning error when count is zero since we
previously would have oopsed.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Reported-by: Chris Thompson <the_cartographer@hotmail.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/vfio/pci/vfio_pci_intrs.c