From: Gerd Hoffmann <kraxel@redhat.com>
To: "Michael S. Tsirkin" <mst@redhat.com>,
Peter Maydell <peter.maydell@linaro.org>,
Prasad J Pandit <ppandit@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>, qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 1/1] display/bochs: fix pcie support
Date: Mon, 12 Aug 2019 08:52:21 +0200 [thread overview]
Message-ID: <20190812065221.20907-2-kraxel@redhat.com> (raw)
In-Reply-To: <20190812065221.20907-1-kraxel@redhat.com>
Set QEMU_PCI_CAP_EXPRESS unconditionally in init(), then clear it in
realize() in case the device is not connected to a PCIe bus.
This makes sure the pci config space allocation is big enough, so
accessing the PCIe extended config space doesn't overflow the pci
config space buffer.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
hw/display/bochs-display.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/hw/display/bochs-display.c b/hw/display/bochs-display.c
index 582133dd719c..8e83b5164b67 100644
--- a/hw/display/bochs-display.c
+++ b/hw/display/bochs-display.c
@@ -297,9 +297,10 @@ static void bochs_display_realize(PCIDevice *dev, Error **errp)
}
if (pci_bus_is_express(pci_get_bus(dev))) {
- dev->cap_present |= QEMU_PCI_CAP_EXPRESS;
ret = pcie_endpoint_cap_init(dev, 0x80);
assert(ret > 0);
+ } else {
+ dev->cap_present &= ~QEMU_PCI_CAP_EXPRESS;
}
memory_region_set_log(&s->vram, true, DIRTY_MEMORY_VGA);
@@ -322,11 +323,15 @@ static void bochs_display_set_big_endian_fb(Object *obj, bool value,
static void bochs_display_init(Object *obj)
{
+ PCIDevice *dev = PCI_DEVICE(obj);
+
/* Expose framebuffer byteorder via QOM */
object_property_add_bool(obj, "big-endian-framebuffer",
bochs_display_get_big_endian_fb,
bochs_display_set_big_endian_fb,
NULL);
+
+ dev->cap_present |= QEMU_PCI_CAP_EXPRESS;
}
static void bochs_display_exit(PCIDevice *dev)
--
2.18.1
next prev parent reply other threads:[~2019-08-12 6:52 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-12 6:52 [Qemu-devel] [PATCH 0/1] display/bochs: fix pcie support (qemu security issue) Gerd Hoffmann
2019-08-12 6:52 ` Gerd Hoffmann [this message]
2019-08-12 12:59 ` [Qemu-devel] [PATCH 1/1] display/bochs: fix pcie support Alex Williamson
2019-08-12 12:45 ` [Qemu-devel] [PATCH 0/1] display/bochs: fix pcie support (qemu security issue) Paolo Bonzini
2019-08-12 12:51 ` Philippe Mathieu-Daudé
2019-08-12 13:39 ` Peter Maydell
2019-08-12 14:15 ` Philippe Mathieu-Daudé
2019-08-12 15:35 ` Alex Williamson
2019-08-12 15:38 ` Peter Maydell
2019-08-12 15:48 ` Alex Williamson
2019-08-12 16:34 ` Peter Maydell
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=20190812065221.20907-2-kraxel@redhat.com \
--to=kraxel@redhat.com \
--cc=mst@redhat.com \
--cc=peter.maydell@linaro.org \
--cc=ppandit@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 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).