Skip to content
Snippets Groups Projects
Commit a8749d7c authored by David Hildenbrand's avatar David Hildenbrand Committed by Philippe Mathieu-Daudé
Browse files

memory: Make memory_region_readd_subregion() properly handle mapped aliases


memory_region_readd_subregion() wants to readd a region by first
removing it and then readding it. For readding, it doesn't use one of
the memory_region_add_*() variants, which is why fail to re-increment the
mr->mapped_via_alias counters, resulting in the
assert(alias->mapped_via_alias >= 0) in memory_region_del_subregion()
triggering the next time we call memory_region_readd_subregion().

Fix it by using memory_region_add_subregion_common() for readding the
region.

Reported-by: default avatarNiek Linnenbank <nieklinnenbank@gmail.com>
Fixes: 5ead6218 ("memory: Make memory_region_is_mapped() succeed when mapped via an alias")
Tested-by: default avatarNiek Linnenbank <nieklinnenbank@gmail.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: Peter Xu <peterx@redhat.com>
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>
Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
Message-Id: <20220201100940.47788-1-david@redhat.com>
Signed-off-by: default avatarPhilippe Mathieu-Daudé <f4bug@amsat.org>
parent 27fc9f36
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment