qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] fw_cfg_mem: add read memory region callback
@ 2018-09-12  5:17 Li Qiang
  2018-09-12  7:16 ` Marc-André Lureau
  0 siblings, 1 reply; 6+ messages in thread
From: Li Qiang @ 2018-09-12  5:17 UTC (permalink / raw)
  To: mst, ehabkost, lersek, peter.maydell, richard.henderson
  Cc: qemu-devel, Li Qiang

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

^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2018-09-12 16:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-09-12  5:17 [Qemu-devel] [PATCH] fw_cfg_mem: add read memory region callback Li Qiang
2018-09-12  7:16 ` 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

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).