vfio/pci: Fix a potential memory leak in vfio_listener_region_add
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>
This commit is contained in:
parent
7e63b31138
commit
fde4dbb7e6
@ -763,7 +763,7 @@ static void vfio_listener_region_add(MemoryListener *listener,
|
|||||||
|
|
||||||
fail:
|
fail:
|
||||||
if (memory_region_is_ram_device(section->mr)) {
|
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;
|
return;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user