qemu/migration-fix-RAMBlock-add-NULL-check.patch
Jiabo Feng 999512f123 QEMU update to version 6.2.0-87(master)
- vdpa: suspend function return 0 when the vdpa device is stopped
- vdpa: don't suspend/resume device when vdpa device not started
- vdpa: support vdpa device suspend/resume
- vdpa: correct param passed in when unregister save
- vdpa: set vring enable only if the vring address has already been set
- shadow_dev: introduce shadow dev for virtio-net device
- revert "tcg/loongarch64: Fix tcg_out_mov() Aborted"
- migration: Set downtime_start even for postcopy
- gdb-xml: fix duplicate register in arm-neon.xml
- iotests: fix default machine type detection
- migration: fix RAMBlock add NULL check
- s390x: Fix spelling errors
- ppc: spelling fixes
- hw/scsi/vhost-scsi: don't double close vhostfd on error
- virtio/vhost-vsock: don't double close vhostfd, remove redundant cleanup
- hw/scsi/vhost-scsi: don't leak vqs on error
- hw/i386/pc: Add missing property descriptions
- pcie_aer: Don't trigger a LSI if none are defined
- pci: Export the pci_intx() function
- hw/qdev: Cosmetic around documentation
- tests/unit: fix a -Wformat-truncation warning
- tests/avocado: mark ReplayKernelNormal.test_mips64el_malta as flaky
- i386/sev: Avoid SEV-ES crash due to missing MSR_EFER_LMA bit
- ui/vnc-clipboard: fix inflate_buffer
- hw/usb/hcd-xhci.c: spelling: tranfer

Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com>
(cherry picked from commit 68fee7dc06a6beb5f69d951e22a7f16091f269ff)
2023-12-22 15:12:17 +08:00

42 lines
1.3 KiB
Diff

From 03569a14e7ae428bad59a4e11637c900ff436816 Mon Sep 17 00:00:00 2001
From: jipengfei <jipengfei_yewu@cmss.chinamobile.com>
Date: Mon, 18 Dec 2023 16:56:15 +0800
Subject: [PATCH] migration: fix RAMBlock add NULL check
qemu_ram_block_from_host() may return NULL, which will be dereferenced w/o
check. Usualy return value is checked for this function.
Found by Linux Verification Center (linuxtesting.org) with SVACE.
cheery-pick from f75ed59f40bed3ce94adad4b3ebbb7bfacfdf4ab
Signed-off-by: jipengfei_yewu <jipengfei_yewu@cmss.chinamobile.com>
Signed-off-by: Dmitry Frolov <frolov@swemel.ru>
Reviewed-by: Fabiano Rosas <farosas@suse.de>
Reviewed-by: Peter Xu <peterx@redhat.com>
Reviewed-by: Juan Quintela <quintela@redhat.com>
Signed-off-by: Juan Quintela <quintela@redhat.com>
Message-ID: <20231010104851.802947-1-frolov@swemel.ru>
---
migration/ram.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/migration/ram.c b/migration/ram.c
index 862955f5b2..c245b04cf2 100644
--- a/migration/ram.c
+++ b/migration/ram.c
@@ -4679,6 +4679,11 @@ static void ram_mig_ram_block_resized(RAMBlockNotifier *n, void *host,
RAMBlock *rb = qemu_ram_block_from_host(host, false, &offset);
Error *err = NULL;
+ if (!rb) {
+ error_report("RAM block not found");
+ return;
+ }
+
if (ramblock_is_ignored(rb)) {
return;
}
--
2.27.0