Patchwork [PULL,23/28] memory.c: bugfix - ref counting mismatch in memory_region_find

login
register
mail settings
Submitter Michael S. Tsirkin
Date Dec. 11, 2013, 6:31 p.m.
Message ID <1386786509-29966-23-git-send-email-mst@redhat.com>
Download mbox | patch
Permalink /patch/300277/
State New
Headers show

Comments

Michael S. Tsirkin - Dec. 11, 2013, 6:31 p.m.
From: Marcel Apfelbaum <marcel.a@redhat.com>

'address_space_get_flatview' gets a reference to a FlatView.
If the flatview lookup fails, the code returns without
"unreferencing" the view.

Cc: qemu-stable@nongnu.org

Signed-off-by: Marcel Apfelbaum <marcel.a@redhat.com>
Reviewed-by: Paolo Bonzini <pbonzini@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 memory.c | 1 +
 1 file changed, 1 insertion(+)

Patch

diff --git a/memory.c b/memory.c
index 28f6449..7764314 100644
--- a/memory.c
+++ b/memory.c
@@ -1596,6 +1596,7 @@  MemoryRegionSection memory_region_find(MemoryRegion *mr,
     view = address_space_get_flatview(as);
     fr = flatview_lookup(view, range);
     if (!fr) {
+        flatview_unref(view);
         return ret;
     }