qemu/migration-dirtyrate-Fix-segmentation-fault.patch
Jiabo Feng 849f452f3d QEMU update to version 8.2.0-15:
- block: Parse filenames only when explicitly requested (CVE-2024-4467)
- iotests/270: Don't store data-file with json: prefix in image (CVE-2024-4467)
- iotests/244: Don't store data-file with protocol in image (CVE-2024-4467)
- qcow2: Don't open data_file with BDRV_O_NO_IO (CVE-2024-4467)
- migration/dirtyrate: Fix segmentation fault
- target/hexagon: idef-parser fix leak of init_list

Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com>
2024-07-11 14:46:13 +08:00

37 lines
1.3 KiB
Diff

From 44b6911233ea62a6a57afd90b259064fac3855ea Mon Sep 17 00:00:00 2001
From: qihao <qihao_yewu@cmss.chinamobile.com>
Date: Tue, 18 Jun 2024 09:50:38 +0800
Subject: [PATCH] migration/dirtyrate: Fix segmentation fault
cheery-pick from e65152d5483b2c847ec7a947ed52650152cfdcc0
Since the kvm_dirty_ring_enabled function accesses a null kvm_state
pointer when the KVM acceleration parameter is not specified, running
calc_dirty_rate with the -r or -b option causes a segmentation fault.
Signed-off-by: Masato Imai <mii@sfc.wide.ad.jp>
Message-ID: <20240507025010.1968881-1-mii@sfc.wide.ad.jp>
[Assert kvm_state when kvm_dirty_ring_enabled was called to fix it. - Hyman]
Signed-off-by: Hyman Huang <yong.huang@smartx.com>
Signed-off-by: qihao_yewu <qihao_yewu@cmss.chinamobile.com>
---
accel/kvm/kvm-all.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/accel/kvm/kvm-all.c b/accel/kvm/kvm-all.c
index b791aad1d6..ade7841ca3 100644
--- a/accel/kvm/kvm-all.c
+++ b/accel/kvm/kvm-all.c
@@ -2343,7 +2343,7 @@ bool kvm_vcpu_id_is_valid(int vcpu_id)
bool kvm_dirty_ring_enabled(void)
{
- return kvm_state->kvm_dirty_ring_size ? true : false;
+ return kvm_state && kvm_state->kvm_dirty_ring_size;
}
static void query_stats_cb(StatsResultList **result, StatsTarget target,
--
2.41.0.windows.1