From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PATCH 1/2] i386/vapic: unref MemoryRegion if vapic_map_rom_writable fails
Date: Wed, 26 Aug 2026 20:15:49 +0200 [thread overview]
Message-ID: <20260826181552.848617-2-pbonzini@redhat.com> (raw)
In-Reply-To: <20260826181552.848617-1-pbonzini@redhat.com>
memory_region_find returns the memory region with an elevated
reference count. Drop the reference count also if the memory
region cannot be mapped writable.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
hw/i386/vapic.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/hw/i386/vapic.c b/hw/i386/vapic.c
index 8dd9188d96f..78dc2312bca 100644
--- a/hw/i386/vapic.c
+++ b/hw/i386/vapic.c
@@ -602,11 +602,13 @@ static int vapic_map_rom_writable(VAPICROMState *s)
/* read ROM size from RAM region */
if (rom_paddr + 2 >= memory_region_size(section.mr)) {
+ memory_region_unref(section.mr);
return -1;
}
ram = memory_region_get_ram_ptr(section.mr);
rom_size = ram[rom_paddr + 2] * ROM_BLOCK_SIZE;
if (rom_size == 0) {
+ memory_region_unref(section.mr);
return -1;
}
s->rom_size = rom_size;
--
2.55.0
next prev parent reply other threads:[~2026-08-26 18:16 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-26 18:15 [PATCH 0/2] vapic: confine the VAPIC region to 0xc0000..0xe0000 Paolo Bonzini
2026-08-26 18:15 ` Paolo Bonzini [this message]
2026-08-27 9:05 ` [PATCH 1/2] i386/vapic: unref MemoryRegion if vapic_map_rom_writable fails Philippe Mathieu-Daudé
2026-08-26 18:15 ` [PATCH 2/2] vapic: confine the VAPIC region to 0xc0000..0xe0000 Paolo Bonzini
2026-08-26 18:58 ` Philippe Mathieu-Daudé
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260826181552.848617-2-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.