Re: [PATCH v2] hw/s390x: Fix memory leaks after removing elements with QTAILQ_REMOVE

2026-05-29 Thread Cornelia Huck
On Mon, May 11 2026, Thomas Huth  wrote:

> From: Thomas Huth 
>
> The elements that get removed with QTAILQ_REMOVE are never referenced
> afterwards anymore, so the corresponding memory should get freed.
>
> Fixes: 37fa32de70 ("s390x/pci: Honor DMA limits set by vfio")
> Reviewed-by: Farhan Ali 
> Signed-off-by: Thomas Huth 
> ---
>  v2: Drop change to hw/s390x/s390-pci-bus.c (since it needs other rework)
>
>  hw/s390x/s390-pci-vfio.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/hw/s390x/s390-pci-vfio.c b/hw/s390x/s390-pci-vfio.c
> index 7c754b656da..db6de00bd28 100644
> --- a/hw/s390x/s390-pci-vfio.c
> +++ b/hw/s390x/s390-pci-vfio.c
> @@ -101,6 +101,7 @@ void s390_pci_end_dma_count(S390pciState *s, 
> S390PCIDMACount *cnt)
>  cnt->users--;
>  if (cnt->users == 0) {
>  QTAILQ_REMOVE(&s->zpci_dma_limit, cnt, link);
> +g_free(cnt);
>  }
>  }
>  

Thanks, queued to s390-next.




Re: [PATCH v2] hw/s390x: Fix memory leaks after removing elements with QTAILQ_REMOVE

2026-05-11 Thread Matthew Rosato
On 5/11/26 2:38 AM, Thomas Huth wrote:
> From: Thomas Huth 
> 
> The elements that get removed with QTAILQ_REMOVE are never referenced
> afterwards anymore, so the corresponding memory should get freed.
> 
> Fixes: 37fa32de70 ("s390x/pci: Honor DMA limits set by vfio")
> Reviewed-by: Farhan Ali 
> Signed-off-by: Thomas Huth 

Code looks good + re-ran tests:

Reviewed-by: Matthew Rosato 
Tested-by: Matthew Rosato 

Thanks Thomas!

> ---
>  v2: Drop change to hw/s390x/s390-pci-bus.c (since it needs other rework)
> 
>  hw/s390x/s390-pci-vfio.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/hw/s390x/s390-pci-vfio.c b/hw/s390x/s390-pci-vfio.c
> index 7c754b656da..db6de00bd28 100644
> --- a/hw/s390x/s390-pci-vfio.c
> +++ b/hw/s390x/s390-pci-vfio.c
> @@ -101,6 +101,7 @@ void s390_pci_end_dma_count(S390pciState *s, 
> S390PCIDMACount *cnt)
>  cnt->users--;
>  if (cnt->users == 0) {
>  QTAILQ_REMOVE(&s->zpci_dma_limit, cnt, link);
> +g_free(cnt);
>  }
>  }
>