[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 16/22] vfio/pci: Fix a potential memory leak in vfio_listener_regi
|
From: |
Cédric Le Goater |
|
Subject: |
[PULL 16/22] vfio/pci: Fix a potential memory leak in vfio_listener_region_add |
|
Date: |
Wed, 18 Oct 2023 11:45:25 +0200 |
From: Zhenzhong Duan <zhenzhong.duan@intel.com>
When there is an failure in vfio_listener_region_add() and the section
belongs to a ram device, there is an inaccurate error report which should
never be related to vfio_dma_map failure. The memory holding err is also
incrementally leaked in each failure.
Fix it by reporting the real error and free it.
Fixes: 567b5b309ab ("vfio/pci: Relax DMA map errors for MMIO regions")
Signed-off-by: Zhenzhong Duan <zhenzhong.duan@intel.com>
Signed-off-by: Cédric Le Goater <clg@redhat.com>
---
hw/vfio/common.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index
9e61de03ee0ee611264ab9943d8e5abc1320c766..5ff5acf1d878a148b7920ce32517be878129940e
100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -763,7 +763,7 @@ static void vfio_listener_region_add(MemoryListener
*listener,
fail:
if (memory_region_is_ram_device(section->mr)) {
- error_report("failed to vfio_dma_map. pci p2p may not work");
+ error_reportf_err(err, "PCI p2p may not work: ");
return;
}
/*
--
2.41.0
- [PULL 00/22] vfio queue, Cédric Le Goater, 2023/10/18
- [PULL 02/22] linux-headers: Add iommufd.h, Cédric Le Goater, 2023/10/18
- [PULL 04/22] vfio/common: Propagate KVM_SET_DEVICE_ATTR error if any, Cédric Le Goater, 2023/10/18
- [PULL 01/22] scripts/update-linux-headers: Add iommufd.h, Cédric Le Goater, 2023/10/18
- [PULL 13/22] vfio/common: Store the parent container in VFIODevice, Cédric Le Goater, 2023/10/18
- [PULL 16/22] vfio/pci: Fix a potential memory leak in vfio_listener_region_add,
Cédric Le Goater <=
- [PULL 06/22] vfio/common: Extract out vfio_kvm_device_[add/del]_fd, Cédric Le Goater, 2023/10/18
- [PULL 07/22] vfio/pci: Introduce vfio_[attach/detach]_device, Cédric Le Goater, 2023/10/18
- [PULL 05/22] vfio/common: Introduce vfio_container_add|del_section_window(), Cédric Le Goater, 2023/10/18
- [PULL 03/22] vfio/common: Move IOMMU agnostic helpers to a separate file, Cédric Le Goater, 2023/10/18
- [PULL 12/22] vfio/common: Introduce a per container device list, Cédric Le Goater, 2023/10/18
- [PULL 17/22] vfio/ap: Remove pointless apdev variable, Cédric Le Goater, 2023/10/18
- [PULL 11/22] vfio/common: Move VFIO reset handler registration to a group agnostic function, Cédric Le Goater, 2023/10/18
- [PULL 14/22] vfio/common: Introduce a global VFIODevice list, Cédric Le Goater, 2023/10/18
- [PULL 08/22] vfio/platform: Use vfio_[attach/detach]_device, Cédric Le Goater, 2023/10/18
- [PULL 09/22] vfio/ap: Use vfio_[attach/detach]_device, Cédric Le Goater, 2023/10/18