Let's make sure to not merge when different memory regions are involved.
Unlikely, but theoretically possible.

Acked-by: Stefan Berger <stef...@linux.ibm.com>
Reviewed-by: Peter Xu <pet...@redhat.com>
Cc: Marc-André Lureau <marcandre.lur...@redhat.com>
Cc: Paolo Bonzini <pbonz...@redhat.com>
Cc: "Michael S. Tsirkin" <m...@redhat.com>
Cc: Eduardo Habkost <ehabk...@redhat.com>
Cc: Alex Williamson <alex.william...@redhat.com>
Cc: Dr. David Alan Gilbert <dgilb...@redhat.com>
Cc: Igor Mammedov <imamm...@redhat.com>
Cc: Claudio Fontana <cfont...@suse.de>
Cc: Thomas Huth <th...@redhat.com>
Cc: "Alex Bennée" <alex.ben...@linaro.org>
Cc: Peter Xu <pet...@redhat.com>
Cc: Laurent Vivier <lviv...@redhat.com>
Cc: Stefan Berger <stef...@linux.ibm.com>
Signed-off-by: David Hildenbrand <da...@redhat.com>
---
 softmmu/memory_mapping.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/softmmu/memory_mapping.c b/softmmu/memory_mapping.c
index e7af276546..d401ca7e31 100644
--- a/softmmu/memory_mapping.c
+++ b/softmmu/memory_mapping.c
@@ -229,7 +229,8 @@ static void guest_phys_blocks_region_add(MemoryListener 
*listener,
 
         /* we want continuity in both guest-physical and host-virtual memory */
         if (predecessor->target_end < target_start ||
-            predecessor->host_addr + predecessor_size != host_addr) {
+            predecessor->host_addr + predecessor_size != host_addr ||
+            predecessor->mr != section->mr) {
             predecessor = NULL;
         }
     }
-- 
2.31.1


Reply via email to