qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hw/intc/s390_flic: Fix crash that occurs when saving the machine state
@ 2024-05-17  6:15 Thomas Huth
  2024-05-17  6:19 ` Cédric Le Goater
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Thomas Huth @ 2024-05-17  6:15 UTC (permalink / raw)
  To: Halil Pasic, Christian Borntraeger, David Hildenbrand, qemu-devel
  Cc: qemu-s390x, Marc Hartmayer, Paolo Bonzini

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.

Reported-by: Marc Hartmayer <mhartmay@linux.ibm.com>
Fixes: 9d1b0f5bf5 ("s390_flic: add migration-enabled property")
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 hw/intc/s390_flic.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c
index 7f93080087..6771645699 100644
--- a/hw/intc/s390_flic.c
+++ b/hw/intc/s390_flic.c
@@ -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;
 }
-- 
2.45.0



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] hw/intc/s390_flic: Fix crash that occurs when saving the machine state
  2024-05-17  6:15 [PATCH] hw/intc/s390_flic: Fix crash that occurs when saving the machine state Thomas Huth
@ 2024-05-17  6:19 ` Cédric Le Goater
  2024-05-17  8:28 ` Marc Hartmayer
  2024-05-17 14:33 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 4+ messages in thread
From: Cédric Le Goater @ 2024-05-17  6:19 UTC (permalink / raw)
  To: Thomas Huth, Halil Pasic, Christian Borntraeger,
	David Hildenbrand, qemu-devel
  Cc: qemu-s390x, Marc Hartmayer, Paolo Bonzini

On 5/17/24 08:15, Thomas Huth wrote:
> 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.
> 
> Reported-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> Fixes: 9d1b0f5bf5 ("s390_flic: add migration-enabled property")
> Signed-off-by: Thomas Huth <thuth@redhat.com>


Reviewed-by: Cédric Le Goater <clg@redhat.com>

Thanks,

C.


> ---
>   hw/intc/s390_flic.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c
> index 7f93080087..6771645699 100644
> --- a/hw/intc/s390_flic.c
> +++ b/hw/intc/s390_flic.c
> @@ -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;
>   }



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] hw/intc/s390_flic: Fix crash that occurs when saving the machine state
  2024-05-17  6:15 [PATCH] hw/intc/s390_flic: Fix crash that occurs when saving the machine state Thomas Huth
  2024-05-17  6:19 ` Cédric Le Goater
@ 2024-05-17  8:28 ` Marc Hartmayer
  2024-05-17 14:33 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 4+ messages in thread
From: Marc Hartmayer @ 2024-05-17  8:28 UTC (permalink / raw)
  To: Thomas Huth, Halil Pasic, Christian Borntraeger,
	David Hildenbrand, qemu-devel
  Cc: qemu-s390x, Paolo Bonzini

On Fri, May 17, 2024 at 08:15 AM +0200, Thomas Huth <thuth@redhat.com> wrote:
> 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.
>
> Reported-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> Fixes: 9d1b0f5bf5 ("s390_flic: add migration-enabled property")
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>  hw/intc/s390_flic.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/hw/intc/s390_flic.c b/hw/intc/s390_flic.c
> index 7f93080087..6771645699 100644
> --- a/hw/intc/s390_flic.c
> +++ b/hw/intc/s390_flic.c
> @@ -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;
>  }
> -- 
> 2.45.0
>

Tested-by: Marc Hartmayer <mhartmay@linux.ibm.com>

Thanks.

-- 
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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] hw/intc/s390_flic: Fix crash that occurs when saving the machine state
  2024-05-17  6:15 [PATCH] hw/intc/s390_flic: Fix crash that occurs when saving the machine state Thomas Huth
  2024-05-17  6:19 ` Cédric Le Goater
  2024-05-17  8:28 ` Marc Hartmayer
@ 2024-05-17 14:33 ` Philippe Mathieu-Daudé
  2 siblings, 0 replies; 4+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-05-17 14:33 UTC (permalink / raw)
  To: Thomas Huth, Halil Pasic, Christian Borntraeger,
	David Hildenbrand, qemu-devel
  Cc: qemu-s390x, Marc Hartmayer, Paolo Bonzini

On 17/5/24 08:15, Thomas Huth wrote:
> 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.
> 
> Reported-by: Marc Hartmayer <mhartmay@linux.ibm.com>
> Fixes: 9d1b0f5bf5 ("s390_flic: add migration-enabled property")
> Signed-off-by: Thomas Huth <thuth@redhat.com>
> ---
>   hw/intc/s390_flic.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2024-05-17 14:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-05-17  6:15 [PATCH] hw/intc/s390_flic: Fix crash that occurs when saving the machine state Thomas Huth
2024-05-17  6:19 ` Cédric Le Goater
2024-05-17  8:28 ` Marc Hartmayer
2024-05-17 14:33 ` Philippe Mathieu-Daudé

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).