]> git.proxmox.com Git - mirror_qemu.git/commit
ARM: ACPI: Fix use-after-free due to memory realloc
authorShannon Zhao <zhaoshenglong@huawei.com>
Thu, 31 May 2018 13:50:53 +0000 (14:50 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Thu, 31 May 2018 15:32:35 +0000 (16:32 +0100)
commit6e3e723966197463117642d8a5fd7b4f6446e510
tree3fbefd8ee42e9271f2c2e0ccc1b3183c7bb5e5d1
parente0a37e266084fb26951465e08515af46807c312c
ARM: ACPI: Fix use-after-free due to memory realloc

acpi_data_push uses g_array_set_size to resize the memory size. If there
is no enough contiguous memory, the address will be changed. So previous
pointer could not be used any more. It must update the pointer and use
the new one.

Also, previous codes wrongly use le32 conversion of iort->node_offset
for subsequent computations that will result incorrect value if host is
not litlle endian. So use the non-converted one instead.

Signed-off-by: Shannon Zhao <zhaoshenglong@huawei.com>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Message-id: 1527663951-14552-1-git-send-email-zhaoshenglong@huawei.com
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
hw/arm/virt-acpi-build.c