Skip to content
  • Paolo Bonzini's avatar
    c6742b14
    memory: fix refcount leak in memory_region_present · c6742b14
    Paolo Bonzini authored
    
    
    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: default avatarPeter Maydell <peter.maydell@linaro.org>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
    c6742b14
    memory: fix refcount leak in memory_region_present
    Paolo Bonzini authored
    
    
    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: default avatarPeter Maydell <peter.maydell@linaro.org>
    Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
Loading