Skip to content

Commit 4ffebe4

Browse files
Alex WilliamsonLee Jones
authored andcommitted
vfio/pci: Clear error and request eventfd ctx after releasing
[ Upstream commit 5c5866c593bbd444d0339ede6a8fb5f14ff66d72 ] The next use of the device will generate an underflow from the stale reference. Cc: Qian Cai <[email protected]> Fixes: 1518ac272e78 ("vfio/pci: fix memory leaks of eventfd ctx") Reported-by: Daniel Wagner <[email protected]> Reviewed-by: Cornelia Huck <[email protected]> Tested-by: Daniel Wagner <[email protected]> Signed-off-by: Alex Williamson <[email protected]> Signed-off-by: Sasha Levin <[email protected]> [Lee: Remove references to non-existent 'req_trigger'] Signed-off-by: Lee Jones <[email protected]> Change-Id: I9228a67dfdc5492547736dcac69995ad1883ab78
1 parent 92af10b commit 4ffebe4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/vfio/pci/vfio_pci.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,10 @@ static void vfio_pci_release(void *device_data)
181181
if (!(--vdev->refcnt)) {
182182
vfio_spapr_pci_eeh_release(vdev->pdev);
183183
vfio_pci_disable(vdev);
184-
if (vdev->err_trigger)
184+
if (vdev->err_trigger) {
185185
eventfd_ctx_put(vdev->err_trigger);
186+
vdev->err_trigger = NULL;
187+
}
186188
}
187189

188190
mutex_unlock(&driver_lock);

0 commit comments

Comments
 (0)