]> git.proxmox.com Git - mirror_qemu.git/commitdiff
target-arm: fix a segmentation fault due to illegal memory access
authorZheng Xiang <xiang.zheng@linaro.org>
Fri, 22 Jun 2018 12:28:35 +0000 (13:28 +0100)
committerPeter Maydell <peter.maydell@linaro.org>
Fri, 22 Jun 2018 12:28:35 +0000 (13:28 +0100)
The elements of kvm_devices_head list are freed in kvm_arm_machine_init_done(),
but we still access these illegal memory in kvm_arm_devlistener_del().

This will cause segment fault when booting guest with MALLOC_PERTURB_=1.

Signed-off-by: Zheng Xiang <xiang.zheng@linaro.org>
Message-id: 20180619075821.9884-1-zhengxiang9@huawei.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target/arm/kvm.c

index 98f50063238c1c2181707717b86de975c34de790..5bf41e151c60a4480c75fe96b1cbeac3549ee8ef 100644 (file)
@@ -256,6 +256,7 @@ static void kvm_arm_machine_init_done(Notifier *notifier, void *data)
             kvm_arm_set_device_addr(kd);
         }
         memory_region_unref(kd->mr);
+        QSLIST_REMOVE_HEAD(&kvm_devices_head, entries);
         g_free(kd);
     }
     memory_listener_unregister(&devlistener);