]> git.proxmox.com Git - mirror_qemu.git/commit - memory.c
memory: fix refcount leak in memory_region_present
authorPaolo Bonzini <pbonzini@redhat.com>
Tue, 14 Jul 2015 11:45:34 +0000 (13:45 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Thu, 16 Jul 2015 18:00:20 +0000 (20:00 +0200)
commitc6742b14fe7352059cd4954a356a8105757af31b
treeeae15d976e0f23a28cc004a44ca863ed440cb888
parent24b41d66c8ad8f77839fca777b92e365dad0cf5c
memory: fix refcount leak in memory_region_present

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: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
memory.c