From e3487c014640a4d9de8f5a0bc53ffe385ffa74b2 Mon Sep 17 00:00:00 2001 From: Rob Bradford Date: Wed, 25 Aug 2021 16:26:19 +0100 Subject: [PATCH] pci: vfio_user: Free BARs associated with vfio-user device This resolves an issue with hotplug -> removal -> hotplug of a vfio-user device as the allocator was not updated with the now unused entries. Signed-off-by: Rob Bradford --- pci/src/vfio_user.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pci/src/vfio_user.rs b/pci/src/vfio_user.rs index 8fd7c5f52..c90856530 100644 --- a/pci/src/vfio_user.rs +++ b/pci/src/vfio_user.rs @@ -234,6 +234,10 @@ impl PciDevice for VfioUserPciDevice { self.common.allocate_bars(allocator, &self.vfio_wrapper) } + fn free_bars(&mut self, allocator: &mut SystemAllocator) -> Result<(), PciDeviceError> { + self.common.free_bars(allocator) + } + fn as_any(&mut self) -> &mut dyn Any { self }