vfio-pci: Fix remove path locking
authorAlex Williamson <alex.williamson@redhat.com>
Mon, 29 Sep 2014 23:18:39 +0000 (17:18 -0600)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 30 Oct 2014 16:43:13 +0000 (09:43 -0700)
commitb6975072a1b9a2f8c527f8f9043dc86cfb70fc6a
tree5299d3b2d17ea1d8811fee136c5f4384979c6adb
parent801c7a20d255e300ab51a6fcb1d0e218d136b16f
vfio-pci: Fix remove path locking

commit 93899a679fd6b2534b5c297d9316bae039ebcbe1 upstream.

Locking both the remove() and release() path results in a deadlock
that should have been obvious.  To fix this we can get and hold the
vfio_device reference as we evaluate whether to do a bus/slot reset.
This will automatically block any remove() calls, allowing us to
remove the explict lock.  Fixes 61d792562b53.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/vfio/pci/vfio_pci.c