qemu-e2k/hw/arm
Markus Armbruster 12148d442e hw/arm: do not free machine->fdt in arm_load_dtb()
At this moment, arm_load_dtb() can free machine->fdt when
binfo->dtb_filename is NULL. If there's no 'dtb_filename', 'fdt' will be
retrieved by binfo->get_dtb(). If get_dtb() returns machine->fdt, as is
the case of machvirt_dtb() from hw/arm/virt.c, fdt now has a pointer to
machine->fdt. And, in that case, the existing g_free(fdt) at the end of
arm_load_dtb() will make machine->fdt point to an invalid memory region.

Since monitor command 'dumpdtb' was introduced a couple of releases
ago, running it with any ARM machine that uses arm_load_dtb() will
crash QEMU.

Let's enable all arm_load_dtb() callers to use dumpdtb properly. Instead
of freeing 'fdt', assign it back to ms->fdt.

Cc: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-arm@nongnu.org
Fixes: bf353ad555 ("qmp/hmp, device_tree.c: introduce dumpdtb")
Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Daniel Henrique Barboza <danielhb413@gmail.com>
Message-id: 20230328165935.1512846-1-armbru@redhat.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2023-04-03 16:12:30 +01:00
..
allwinner-a10.c include/hw/arm/allwinner-a10.h: Remove superfluous includes from the header 2023-02-27 13:27:03 +00:00
allwinner-h3.c hw: arm: allwinner-h3: Fix and complete H3 i2c devices 2023-03-06 15:31:24 +00:00
armsse.c error: Move ERRP_GUARD() to the beginning of the function 2022-12-14 16:19:35 +01:00
armv7m.c
aspeed_ast10x0.c hw/arm/aspeed_ast10x0: Add TODO comment to use Cortex-M4F 2023-02-07 09:02:05 +01:00
aspeed_ast2600.c aspeed: Introduce a spi_boot region under the SoC 2023-03-02 13:57:50 +01:00
aspeed_eeprom.c hw/arm/aspeed: Modified BMC FRU byte data in yosemitev2 2023-03-07 16:53:18 +01:00
aspeed_eeprom.h hw/arm/aspeed: Adding new machine Tiogapass in QEMU 2023-03-02 13:57:50 +01:00
aspeed_soc.c aspeed: Introduce a spi_boot region under the SoC 2023-03-02 13:57:50 +01:00
aspeed.c hw/arm/aspeed: Added TMP421 type sensor's support in tiogapass 2023-03-07 16:53:18 +01:00
bcm2835_peripherals.c
bcm2836.c hw/arm/bcm2836: Remove definitions generated by OBJECT_DECLARE_TYPE() 2023-01-12 17:15:09 +00:00
boot.c hw/arm: do not free machine->fdt in arm_load_dtb() 2023-04-03 16:12:30 +01:00
collie.c *: Add missing includes of qemu/error-report.h 2023-03-22 15:06:57 +00:00
cubieboard.c *: Add missing includes of qemu/error-report.h 2023-03-22 15:06:57 +00:00
digic_boards.c
digic.c
exynos4_boards.c
exynos4210.c hw: Replace qemu_or_irq typedef by OrIRQState 2023-02-27 13:27:05 +00:00
fby35.c aspeed: Introduce a spi_boot region under the SoC 2023-03-02 13:57:50 +01:00
fsl-imx6.c
fsl-imx6ul.c i.MX6UL: Add a specific GPT timer instance for the i.MX6UL 2023-01-05 15:02:08 +00:00
fsl-imx7.c i.MX7D: Connect IRQs to GPIO devices. 2023-01-05 15:04:17 +00:00
fsl-imx25.c
fsl-imx31.c
gumstix.c hw/arm: Remove unreachable code calling pflash_cfi01_register() 2023-01-12 17:03:14 +00:00
highbank.c
imx25_pdk.c
integratorcp.c
Kconfig hw/arm: Add missing XLNX_ZYNQMP_ARM -> USB_DWC3 Kconfig dependency 2023-02-16 16:00:47 +00:00
kzm.c
mainstone.c hw/arm: Remove unreachable code calling pflash_cfi01_register() 2023-01-12 17:03:14 +00:00
mcimx6ul-evk.c
mcimx7d-sabre.c
meson.build hw/arm/aspeed: Add aspeed_eeprom.c 2023-02-07 09:02:05 +01:00
microbit.c
mps2-tz.c hw: Replace qemu_or_irq typedef by OrIRQState 2023-02-27 13:27:05 +00:00
mps2.c hw/char/cmsdk-apb-uart: Open-code cmsdk_apb_uart_create() 2023-02-27 13:27:05 +00:00
msf2-soc.c
msf2-som.c tests/avocado: Truncate M2S-FG484 SOM SPI flash to 16MiB 2023-02-07 09:02:04 +01:00
musca.c
musicpal.c *: Add missing includes of qemu/error-report.h 2023-03-22 15:06:57 +00:00
netduino2.c
netduinoplus2.c
npcm7xx_boards.c *: Add missing includes of qemu/error-report.h 2023-03-22 15:06:57 +00:00
npcm7xx.c hw/arm: Attach PSPI module to NPCM7XX SoC 2023-02-16 16:00:48 +00:00
nrf51_soc.c
nseries.c *: Add missing includes of qemu/error-report.h 2023-03-22 15:06:57 +00:00
olimex-stm32-h405.c hw/arm: Add Olimex H405 2023-01-12 16:50:19 +00:00
omap1.c hw/arm/omap: Drop useless casts from void * to pointer 2023-01-12 17:15:09 +00:00
omap2.c hw/arm/omap: Drop useless casts from void * to pointer 2023-01-12 17:15:09 +00:00
omap_sx1.c *: Add missing includes of qemu/error-report.h 2023-03-22 15:06:57 +00:00
orangepi.c *: Add missing includes of qemu/error-report.h 2023-03-22 15:06:57 +00:00
palm.c *: Add missing includes of qemu/error-report.h 2023-03-22 15:06:57 +00:00
pxa2xx_gpio.c
pxa2xx_pic.c
pxa2xx.c hw/arm/pxa2xx: Simplify pxa270_init() 2023-01-12 17:03:14 +00:00
raspi.c
realview.c hw/i2c/versatile_i2c: Replace TYPE_VERSATILE_I2C -> TYPE_ARM_SBCON_I2C 2023-01-23 13:32:38 +00:00
sabrelite.c
sbsa-ref.c hw/ide: Rename ide_create_drive() -> ide_bus_create_drive() 2023-02-27 22:29:02 +01:00
smmu-common.c smmu: switch to use memory_region_unmap_iommu_notifier_range() 2023-03-02 19:13:52 -05:00
smmu-internal.h
smmuv3-internal.h hw/arm/smmuv3: Add GBPA register 2023-02-16 16:00:47 +00:00
smmuv3.c hw/arm/smmuv3: Add GBPA register 2023-02-16 16:00:47 +00:00
spitz.c hw/arm/pxa2xx: Simplify pxa270_init() 2023-01-12 17:03:14 +00:00
stellaris.c hw/char/pl011: Open-code pl011_luminary_create() 2023-02-27 13:27:05 +00:00
stm32f100_soc.c
stm32f205_soc.c
stm32f405_soc.c hw/arm/stm32f405: correctly describe the memory layout 2023-01-12 16:50:18 +00:00
stm32vldiscovery.c
strongarm.c bulk: Rename TARGET_FMT_plx -> HWADDR_FMT_plx 2023-01-18 11:14:34 +01:00
strongarm.h
tosa.c hw/arm/pxa2xx: Simplify pxa255_init() 2023-01-12 17:03:14 +00:00
trace-events
trace.h
versatilepb.c hw/i2c/versatile_i2c: Replace TYPE_VERSATILE_I2C -> TYPE_ARM_SBCON_I2C 2023-01-23 13:32:38 +00:00
vexpress.c hw/i2c/versatile_i2c: Replace TYPE_VERSATILE_I2C -> TYPE_ARM_SBCON_I2C 2023-01-23 13:32:38 +00:00
virt-acpi-build.c hw/arm/virt: Enable HMAT on arm virt machine 2022-11-07 14:08:17 -05:00
virt.c target/arm: Use "max" as default cpu for the virt machine with KVM 2023-02-16 16:27:25 +00:00
xilinx_zynq.c
xlnx-versal-virt.c
xlnx-versal.c Drop duplicate #include 2023-02-08 07:28:05 +01:00
xlnx-zcu102.c
xlnx-zynqmp.c
z2.c hw/arm: Remove unreachable code calling pflash_cfi01_register() 2023-01-12 17:03:14 +00:00