Skip to contentSkip to conversation

hw/intc/s390_flic: Fix crash that occurs when saving the machine state

PATCH In review Thomas Huth 4 participants 4 messages May 17, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hw/intc/s390_flic: Fix crash that occurs when saving the machine state

adapter_info_so_needed() treats its "opaque" parameter as a S390FLICState, but the function belongs to a VMStateDescription that is attached to a TYPE_VIRTIO_CCW_BUS device. This is currently causing a crash when the user tries to save or migrate the VM state. Fix it by using s390_get_flic() to get the correct device here instead.

Fixes 9d1b0f5bf5 ("s390_flic: add migration-enabled property")
---
 hw/intc/s390_flic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/s390_flic.c +1 -1
index 7f93080087..6771645699 100644
@@ -459,7 +459,7 @@ type_init(qemu_s390_flic_register_types)
 
 static bool adapter_info_so_needed(void *opaque)
 {
-    S390FLICState *fs = S390_FLIC_COMMON(opaque);
+    S390FLICState *fs = s390_get_flic();
 
     return fs->migration_enabled;
 }
Signature · 1 line
2.45.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 9 lines · Thomas Huth

adapter_info_so_needed() treats its "opaque" parameter as a S390FLICState, but the function belongs to a VMStateDescription that is attached to a TYPE_VIRTIO_CCW_BUS device. This is currently causing a crash when the user tries to save or migrate the VM state. Fix it by using s390_get_flic() to get the correct device here instead.

Fixes 9d1b0f5bf5 ("s390_flic: add migration-enabled property")

Thanks,

C.

Quoted 17 lines
---
  hw/intc/s390_flic.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/s390_flic.c +1 -1
index 7f93080087..6771645699 100644
@@ -459,7 +459,7 @@ type_init(qemu_s390_flic_register_types)
 
  static bool adapter_info_so_needed(void *opaque)
  {
-    S390FLICState *fs = S390_FLIC_COMMON(opaque);
+    S390FLICState *fs = s390_get_flic();
 
      return fs->migration_enabled;
  }
Tested-by on v1 1/1
#2 lore raw
In reply to Thomas Huth
Quoted 29 lines · Thomas Huth

adapter_info_so_needed() treats its "opaque" parameter as a S390FLICState, but the function belongs to a VMStateDescription that is attached to a TYPE_VIRTIO_CCW_BUS device. This is currently causing a crash when the user tries to save or migrate the VM state. Fix it by using s390_get_flic() to get the correct device here instead.

Fixes 9d1b0f5bf5 ("s390_flic: add migration-enabled property")
---
 hw/intc/s390_flic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
hw/intc/s390_flic.c +1 -1
index 7f93080087..6771645699 100644
@@ -459,7 +459,7 @@ type_init(qemu_s390_flic_register_types)
 
 static bool adapter_info_so_needed(void *opaque)
 {
-    S390FLICState *fs = S390_FLIC_COMMON(opaque);
+    S390FLICState *fs = s390_get_flic();
 
     return fs->migration_enabled;
 }
Signature · 1 line
2.45.0

Thanks.

Signature · 8 lines
Kind regards / Beste Grüße
   Marc Hartmayer

IBM Deutschland Research & Development GmbH
Vorsitzender des Aufsichtsrats: Wolfgang Wendt
Geschäftsführung: David Faller
Sitz der Gesellschaft: Böblingen
Registergericht: Amtsgericht Stuttgart, HRB 243294
Reviewed-by on v1 1/1
#3 lore raw
In reply to Thomas Huth
Quoted 6 lines · Thomas Huth

adapter_info_so_needed() treats its "opaque" parameter as a S390FLICState, but the function belongs to a VMStateDescription that is attached to a TYPE_VIRTIO_CCW_BUS device. This is currently causing a crash when the user tries to save or migrate the VM state. Fix it by using s390_get_flic() to get the correct device here instead.

Quoted 6 lines
Fixes 9d1b0f5bf5 ("s390_flic: add migration-enabled property")
---
  hw/intc/s390_flic.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)