[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stable-7.2.8 18/24] hw/acpi/erst: Do not ignore Error* in realize handl
From: |
Michael Tokarev |
Subject: |
[Stable-7.2.8 18/24] hw/acpi/erst: Do not ignore Error* in realize handler |
Date: |
Wed, 13 Dec 2023 16:00:27 +0300 |
From: Philippe Mathieu-Daudé <philmd@linaro.org>
erst_realizefn() passes @errp to functions without checking for
failure. If it runs into another failure, it trips error_setv()'s
assertion.
Use the ERRP_GUARD() macro and check *errp, as suggested in commit
ae7c80a7bd ("error: New macro ERRP_GUARD()").
Cc: qemu-stable@nongnu.org
Fixes: f7e26ffa59 ("ACPI ERST: support for ACPI ERST feature")
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-Id: <20231120130017.81286-1-philmd@linaro.org>
Reviewed-by: Ani Sinha <anisinha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
(cherry picked from commit 20bc50137f3add52eb4788b420d717de27fed14b)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
diff --git a/hw/acpi/erst.c b/hw/acpi/erst.c
index aefcc03ad6..2e057b1800 100644
--- a/hw/acpi/erst.c
+++ b/hw/acpi/erst.c
@@ -947,6 +947,7 @@ static const VMStateDescription erst_vmstate = {
static void erst_realizefn(PCIDevice *pci_dev, Error **errp)
{
+ ERRP_GUARD();
ERSTDeviceState *s = ACPIERST(pci_dev);
trace_acpi_erst_realizefn_in();
@@ -964,9 +965,15 @@ static void erst_realizefn(PCIDevice *pci_dev, Error
**errp)
/* HostMemoryBackend size will be multiple of PAGE_SIZE */
s->storage_size = object_property_get_int(OBJECT(s->hostmem), "size",
errp);
+ if (*errp) {
+ return;
+ }
/* Initialize backend storage and record_count */
check_erst_backend_storage(s, errp);
+ if (*errp) {
+ return;
+ }
/* BAR 0: Programming registers */
memory_region_init_io(&s->iomem_mr, OBJECT(pci_dev), &erst_reg_ops, s,
@@ -977,6 +984,9 @@ static void erst_realizefn(PCIDevice *pci_dev, Error **errp)
memory_region_init_ram(&s->exchange_mr, OBJECT(pci_dev),
"erst.exchange",
le32_to_cpu(s->header->record_size), errp);
+ if (*errp) {
+ return;
+ }
pci_register_bar(pci_dev, 1, PCI_BASE_ADDRESS_SPACE_MEMORY,
&s->exchange_mr);
--
2.39.2
- [Stable-7.2.8 05/24] linux-user: Fix loaddr computation for some elf files, (continued)
- [Stable-7.2.8 05/24] linux-user: Fix loaddr computation for some elf files, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 03/24] net: Provide MemReentrancyGuard * to qemu_new_nic(), Michael Tokarev, 2023/12/13
- [Stable-7.2.8 07/24] tests/avocado: Replace assertRegexpMatches() for Python 3.12 compatibility, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 12/24] hw/nvram/xlnx-efuse-ctrl: Free XlnxVersalEFuseCtrl[] "pg0-lock" array, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 09/24] hw/virtio: Free VirtIOIOMMUPCI::vdev.reserved_regions[] on finalize(), Michael Tokarev, 2023/12/13
- [Stable-7.2.8 10/24] hw/misc/mps2-scc: Free MPS2SCC::oscclk[] array on finalize(), Michael Tokarev, 2023/12/13
- [Stable-7.2.8 11/24] hw/nvram/xlnx-efuse: Free XlnxEFuse::ro_bits[] array on finalize(), Michael Tokarev, 2023/12/13
- [Stable-7.2.8 13/24] hw/virtio: Add VirtioPCIDeviceTypeInfo::instance_finalize field, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 15/24] hw/mips/malta: Fix the malta machine on big endian hosts, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 14/24] vmdk: Don't corrupt desc file in vmdk_write_cid, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 18/24] hw/acpi/erst: Do not ignore Error* in realize handler,
Michael Tokarev <=
- [Stable-7.2.8 16/24] hw/audio/hda-codec: fix multiplication overflow, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 21/24] ui/gtk-egl: move function calls back to regular code path, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 20/24] ui/gtk-egl: Check EGLSurface before doing scanout, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 19/24] msix: unset PCIDevice::msix_vector_poll_notifier in rollback, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 24/24] system/memory: use ldn_he_p/stn_he_p, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 22/24] ui/vnc-clipboard: fix inflate_buffer, Michael Tokarev, 2023/12/13
- [Stable-7.2.8 23/24] target/arm: Disable SME if SVE is disabled, Michael Tokarev, 2023/12/13
- Re: [Stable-7.2.8 00/24] Patch Round-up for stable 7.2.8, freeze on 2023-12-23, Cole Robinson, 2023/12/13