qemu/physmem-Bail-out-qemu_ram_block_from_host-for-invali.patch
Jiabo Feng b36d41c519 QEMU update to version 8.2.0-17:
- cvm : bug fix for undefined reference to 'virtcca_cvm_allowed' while compiling
- cvm : bug-fix for incorrect device name check for vhost-user-fs
- target/i386: add control bits support for LAM
- target/i386: add support for LAM in CPUID enumeration
- Add support for the virtcca cvm feature.
- target/sparc: use signed denominator in sdiv helper
- crypto: Introduce SM4 symmetric cipher algorithm
- ppc/vof: Fix unaligned FDT property access
- vl: fix "type is NULL" in -vga help
- hw/display/bcm2835_fb: fix fb_use_offsets condition
- aspeed/smc: Fix possible integer overflow
- hw/nvme: fix number of PIDs for FDP RUH update
- hw/nvme: fix memory leak in nvme_dsm
- hvf: arm: Do not advance PC when raising an exception
- physmem: Bail out qemu_ram_block_from_host() for invalid ram addrs

Signed-off-by: Jiabo Feng <fengjiabo1@huawei.com>
2024-09-05 11:24:12 +08:00

41 lines
1.4 KiB
Diff

From 39eae397a6b573505c0e84cc808cd9765a950908 Mon Sep 17 00:00:00 2001
From: guping <guping_yewu@cmss.chinamobile.com>
Date: Mon, 15 Jul 2024 00:54:12 +0000
Subject: [PATCH] physmem: Bail out qemu_ram_block_from_host() for invalid ram
addrs cherry-pick from 596ccccdbfa124adb42be8c2faf0c74f4849c7a6
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Bail out in qemu_ram_block_from_host() when
xen_ram_addr_from_mapcache() does not find an existing
mapping.
Signed-off-by: default avatarEdgar E. Iglesias <edgar.iglesias@amd.com>
Reviewed-by: default avatarAlex Bennée <alex.bennee@linaro.org>
Reviewed-by: default avatarStefano Stabellini <sstabellini@kernel.org>
Signed-off-by: guping <guping_yewu@cmss.chinamobile.com>
---
system/physmem.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/system/physmem.c b/system/physmem.c
index cbe838f203..0c629233bd 100644
--- a/system/physmem.c
+++ b/system/physmem.c
@@ -2263,6 +2263,10 @@ RAMBlock *qemu_ram_block_from_host(void *ptr, bool round_offset,
ram_addr_t ram_addr;
RCU_READ_LOCK_GUARD();
ram_addr = xen_ram_addr_from_mapcache(ptr);
+ if (ram_addr == RAM_ADDR_INVALID) {
+ return NULL;
+ }
+
block = qemu_get_ram_block(ram_addr);
if (block) {
*offset = ram_addr - block->offset;
--
2.41.0.windows.1