All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] hw/s390x: Fix memory leaks after removing elements with QTAILQ_REMOVE
@ 2026-05-11  6:38 Thomas Huth
  2026-05-11 14:05 ` Matthew Rosato
  2026-05-29 13:58 ` Cornelia Huck
  0 siblings, 2 replies; 3+ messages in thread
From: Thomas Huth @ 2026-05-11  6:38 UTC (permalink / raw)
  To: qemu-s390x, Matthew Rosato, Farhan Ali
  Cc: qemu-devel, Eric Farman, Cornelia Huck, Halil Pasic

From: Thomas Huth <thuth@redhat.com>

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 <alifm@linux.ibm.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
---
 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);
     }
 }
 
-- 
2.54.0



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

end of thread, other threads:[~2026-05-29 13:59 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-11  6:38 [PATCH v2] hw/s390x: Fix memory leaks after removing elements with QTAILQ_REMOVE Thomas Huth
2026-05-11 14:05 ` Matthew Rosato
2026-05-29 13:58 ` Cornelia Huck

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.