From: Li Qiang <liq3ea@gmail.com>
To: mst@redhat.com, ehabkost@redhat.com, lersek@redhat.com,
peter.maydell@linaro.org, richard.henderson@linaro.org
Cc: qemu-devel@nongnu.org, Li Qiang <liq3ea@gmail.com>
Subject: [Qemu-devel] [PATCH] fw_cfg_mem: add read memory region callback
Date: Tue, 11 Sep 2018 22:17:41 -0700 [thread overview]
Message-ID: <1536729461-2692-1-git-send-email-liq3ea@gmail.com> (raw)
The write/read should be paired, this can avoid the
NULL-deref while the guest reads the fw_cfg port.
Signed-off-by: Li Qiang <liq3ea@gmail.com>
---
hw/nvram/fw_cfg.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/hw/nvram/fw_cfg.c b/hw/nvram/fw_cfg.c
index d79a568f54..6de7809f1a 100644
--- a/hw/nvram/fw_cfg.c
+++ b/hw/nvram/fw_cfg.c
@@ -434,6 +434,11 @@ static bool fw_cfg_data_mem_valid(void *opaque, hwaddr addr,
return addr == 0;
}
+static uint64_t fw_cfg_ctl_mem_read(void *opaque, hwaddr addr, unsigned size)
+{
+ return 0;
+}
+
static void fw_cfg_ctl_mem_write(void *opaque, hwaddr addr,
uint64_t value, unsigned size)
{
@@ -468,6 +473,7 @@ static bool fw_cfg_comb_valid(void *opaque, hwaddr addr,
}
static const MemoryRegionOps fw_cfg_ctl_mem_ops = {
+ .read = fw_cfg_ctl_mem_read,
.write = fw_cfg_ctl_mem_write,
.endianness = DEVICE_BIG_ENDIAN,
.valid.accepts = fw_cfg_ctl_mem_valid,
--
2.11.0
next reply other threads:[~2018-09-12 5:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-12 5:17 Li Qiang [this message]
2018-09-12 7:16 ` [Qemu-devel] [PATCH] fw_cfg_mem: add read memory region callback Marc-André Lureau
2018-09-12 8:02 ` Li Qiang
2018-09-12 10:36 ` Laszlo Ersek
2018-09-12 12:33 ` Li Qiang
2018-09-12 16:52 ` Eric Blake
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=1536729461-2692-1-git-send-email-liq3ea@gmail.com \
--to=liq3ea@gmail.com \
--cc=ehabkost@redhat.com \
--cc=lersek@redhat.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=richard.henderson@linaro.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).