mirror of
https://github.com/qemu/qemu.git
synced 2026-04-05 21:46:25 +00:00
Commit2fb627ef2f("memory: Factor out common ram region initialization") introduced a helper function memory_region_set_ram_block(), which causes mr->ram to be set to true after the RAM Block allocation by qemu_ram_alloc_*(). It leads to the assertion g_assert(memory_region_is_ram(mr)); in memory_region_set_ram_discard_manager() being triggered when creating RAM Block with the RAM_GUEST_MEMFD flag. Fix this by restoring the original behavior of setting mr->ram before RAM Block allocation. Closes: https://gitlab.com/qemu-project/qemu/-/work_items/3330 Reported-by: Farrah Chen <farrah.chen@intel.com> Link: https://lore.kernel.org/r/df63fdf0-05ea-4de0-8009-c52703e4b052@amd.com Reported-by: Kim Phillips <kim.phillips@amd.com> Fixes:2fb627ef2f("memory: Factor out common ram region initialization") Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com> Tested-by: Kim Phillips <kim.phillips@amd.com> Link: https://lore.kernel.org/r/20260312063420.973637-1-xiaoyao.li@intel.com Signed-off-by: Peter Xu <peterx@redhat.com>