• P
    memory: fix refcount leak in memory_region_present · c6742b14
    Paolo Bonzini 提交于
    memory_region_present() leaks a reference to a MemoryRegion in the
    case "mr == container".  While fixing it, avoid reference counting
    altogether for memory_region_present(), by using RCU only.
    
    The return value could in principle be already invalid immediately
    after memory_region_present returns, but presumably the caller knows
    that and it's using memory_region_present to probe for devices that
    are unpluggable, or something like that.  The RCU critical section
    is needed anyway, because it protects as->current_map.
    Reported-by: NPeter Maydell <peter.maydell@linaro.org>
    Signed-off-by: NPaolo Bonzini <pbonzini@redhat.com>
    c6742b14
memory.c 70.7 KB