[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL v2 05/61] hw/cxl/cxl-host: Fix segmentation fault when getting cxl
From: |
Michael S. Tsirkin |
Subject: |
[PULL v2 05/61] hw/cxl/cxl-host: Fix segmentation fault when getting cxl-fmw property |
Date: |
Tue, 23 Jul 2024 06:55:33 -0400 |
From: Zhao Liu <zhao1.liu@intel.com>
QEMU crashes (Segmentation fault) when getting cxl-fmw property via
qmp:
(QEMU) qom-get path=machine property=cxl-fmw
This issue is caused by accessing wrong callback (opaque) type in
machine_get_cfmw().
cxl_machine_init() sets the callback as `CXLState *` type but
machine_get_cfmw() treats the callback as
`CXLFixedMemoryWindowOptionsList **`.
Fix this error by casting opaque to `CXLState *` type in
machine_get_cfmw().
Fixes: 03b39fcf64bc ("hw/cxl: Make the CXL fixed memory window setup a machine
parameter.")
Signed-off-by: Zhao Liu <zhao1.liu@intel.com>
Reviewed-by: Li Zhijian <lizhijian@fujitsu.com>
Reviewed-by: Xingtao Yao <yaoxt.fnst@fujitsu.com>
Link:
20240704093404.1848132-1-zhao1.liu@linux.intel.com">https://lore.kernel.org/r/20240704093404.1848132-1-zhao1.liu@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Message-Id: <20240705113956.941732-2-Jonathan.Cameron@huawei.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
hw/cxl/cxl-host.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/hw/cxl/cxl-host.c b/hw/cxl/cxl-host.c
index c5f5fcfd64..e9f2543c43 100644
--- a/hw/cxl/cxl-host.c
+++ b/hw/cxl/cxl-host.c
@@ -315,7 +315,8 @@ static void machine_set_cxl(Object *obj, Visitor *v, const
char *name,
static void machine_get_cfmw(Object *obj, Visitor *v, const char *name,
void *opaque, Error **errp)
{
- CXLFixedMemoryWindowOptionsList **list = opaque;
+ CXLState *state = opaque;
+ CXLFixedMemoryWindowOptionsList **list = &state->cfmw_list;
visit_type_CXLFixedMemoryWindowOptionsList(v, name, list, errp);
}
--
MST
- [PULL v2 00/61] virtio,pci,pc: features,fixes, Michael S. Tsirkin, 2024/07/23
- [PULL v2 01/61] hw/virtio/virtio-crypto: Fix op_code assignment in virtio_crypto_create_asym_session, Michael S. Tsirkin, 2024/07/23
- [PULL v2 02/61] MAINTAINERS: add Stefano Garzarella as vhost/vhost-user reviewer, Michael S. Tsirkin, 2024/07/23
- [PULL v2 03/61] hw/cxl/cxl-mailbox-utils: remove unneeded mailbox output payload space zeroing, Michael S. Tsirkin, 2024/07/23
- [PULL v2 05/61] hw/cxl/cxl-host: Fix segmentation fault when getting cxl-fmw property,
Michael S. Tsirkin <=
- [PULL v2 06/61] hw/cxl: Add get scan media capabilities cmd support, Michael S. Tsirkin, 2024/07/23
- [PULL v2 07/61] hw/cxl/mbox: replace sanitize_running() with cxl_dev_media_disabled(), Michael S. Tsirkin, 2024/07/23
- [PULL v2 04/61] hw/cxl: Check for multiple mappings of memory backends., Michael S. Tsirkin, 2024/07/23
- [PULL v2 08/61] hw/cxl/events: discard all event records during sanitation, Michael S. Tsirkin, 2024/07/23
- [PULL v2 09/61] hw/cxl: Add get scan media results cmd support, Michael S. Tsirkin, 2024/07/23
- [PULL v2 10/61] cxl/mailbox: move mailbox effect definitions to a header, Michael S. Tsirkin, 2024/07/23
- [PULL v2 11/61] hw/cxl/cxl-mailbox-utils: Add support for feature commands (8.2.9.6), Michael S. Tsirkin, 2024/07/23
- [PULL v2 12/61] hw/cxl/cxl-mailbox-utils: Add device patrol scrub control feature, Michael S. Tsirkin, 2024/07/23
- [PULL v2 13/61] hw/cxl/cxl-mailbox-utils: Add device DDR5 ECS control feature, Michael S. Tsirkin, 2024/07/23
- [PULL v2 14/61] hw/cxl: Support firmware updates, Michael S. Tsirkin, 2024/07/23