From: "Hervé Poussineau" <hpoussin@reactos.org>
To: qemu-devel@nongnu.org
Cc: "Hervé Poussineau" <hpoussin@reactos.org>,
"Leon Alrae" <leon.alrae@imgtec.com>,
"Aurelien Jarno" <aurelien@aurel32.net>
Subject: [Qemu-devel] [PATCH for 2.4 2/3] net/dp8393x: specify memory operations for PROM PROM
Date: Fri, 24 Jul 2015 20:42:22 +0200 [thread overview]
Message-ID: <1437763343-7980-3-git-send-email-hpoussin@reactos.org> (raw)
In-Reply-To: <1437763343-7980-1-git-send-email-hpoussin@reactos.org>
This fixes a guest-triggerable QEMU crash when guest tries to write to PROM.
Signed-off-by: Hervé Poussineau <hpoussin@reactos.org>
---
hw/net/dp8393x.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/hw/net/dp8393x.c b/hw/net/dp8393x.c
index 8fafdb0..55168b5 100644
--- a/hw/net/dp8393x.c
+++ b/hw/net/dp8393x.c
@@ -601,6 +601,16 @@ static const MemoryRegionOps dp8393x_ops = {
.endianness = DEVICE_NATIVE_ENDIAN,
};
+static bool dp8393x_rom_accepts(void *opaque, hwaddr addr, unsigned int size,
+ bool is_write)
+{
+ return !is_write;
+}
+
+static const MemoryRegionOps dp8393x_rom_ops = {
+ .valid.accepts = dp8393x_rom_accepts,
+};
+
static void dp8393x_watchdog(void *opaque)
{
dp8393xState *s = opaque;
@@ -840,7 +850,7 @@ static void dp8393x_realize(DeviceState *dev, Error **errp)
s->watchdog = timer_new_ns(QEMU_CLOCK_VIRTUAL, dp8393x_watchdog, s);
s->regs[SONIC_SR] = 0x0004; /* only revision recognized by Linux */
- memory_region_init_rom_device(&s->prom, OBJECT(dev), NULL, NULL,
+ memory_region_init_rom_device(&s->prom, OBJECT(dev), &dp8393x_rom_ops, NULL,
"dp8393x-prom", SONIC_PROM_SIZE, NULL);
prom = memory_region_get_ram_ptr(&s->prom);
checksum = 0;
--
2.1.4
next prev parent reply other threads:[~2015-07-24 18:46 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-07-24 18:42 [Qemu-devel] [PATCH for 2.4 0/3] net/dp8393x: misc fixes Hervé Poussineau
2015-07-24 18:42 ` [Qemu-devel] [PATCH for 2.4 1/3] net/dp8393x: disable user creation Hervé Poussineau
2015-07-26 20:11 ` Aurelien Jarno
2015-07-24 18:42 ` Hervé Poussineau [this message]
2015-07-26 20:11 ` [Qemu-devel] [PATCH for 2.4 2/3] net/dp8393x: specify memory operations for PROM PROM Aurelien Jarno
2015-07-26 20:35 ` Hervé Poussineau
2015-07-26 22:08 ` Aurelien Jarno
2015-07-27 10:38 ` Paolo Bonzini
2015-07-24 18:42 ` [Qemu-devel] [PATCH for 2.4 3/3] net/dp8393x: remove check of runt packets Hervé Poussineau
2015-07-26 20:14 ` Aurelien Jarno
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=1437763343-7980-3-git-send-email-hpoussin@reactos.org \
--to=hpoussin@reactos.org \
--cc=aurelien@aurel32.net \
--cc=leon.alrae@imgtec.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).