qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/1] VFIO fixes 2021-11-17 (for v6.2)
@ 2021-11-17 19:17 Alex Williamson
  2021-11-17 19:17 ` [PULL 1/1] vfio: Fix memory leak of hostwin Alex Williamson
  2021-11-18 10:13 ` [PULL 0/1] VFIO fixes 2021-11-17 (for v6.2) Richard Henderson
  0 siblings, 2 replies; 3+ messages in thread
From: Alex Williamson @ 2021-11-17 19:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: liangpeng10, alex.williamson

The following changes since commit 3bb87484e77d22cf4e580a78856529c982195d32:

  Merge tag 'pull-request-2021-11-17' of https://gitlab.com/thuth/qemu into staging (2021-11-17 12:35:51 +0100)

are available in the Git repository at:

  git://github.com/awilliam/qemu-vfio.git tags/vfio-fixes-20211117.0

for you to fetch changes up to f3bc3a73c908df15966e66f88d5a633bd42fd029:

  vfio: Fix memory leak of hostwin (2021-11-17 11:25:55 -0700)

----------------------------------------------------------------
VFIO fixes 2021-11-17

 * Fix hostwin memory leak (Peng Liang)

----------------------------------------------------------------
Peng Liang (1):
      vfio: Fix memory leak of hostwin

 hw/vfio/common.c | 8 ++++++++
 1 file changed, 8 insertions(+)




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

* [PULL 1/1] vfio: Fix memory leak of hostwin
  2021-11-17 19:17 [PULL 0/1] VFIO fixes 2021-11-17 (for v6.2) Alex Williamson
@ 2021-11-17 19:17 ` Alex Williamson
  2021-11-18 10:13 ` [PULL 0/1] VFIO fixes 2021-11-17 (for v6.2) Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Williamson @ 2021-11-17 19:17 UTC (permalink / raw)
  To: qemu-devel; +Cc: liangpeng10, alex.williamson

From: Peng Liang <liangpeng10@huawei.com>

hostwin is allocated and added to hostwin_list in vfio_host_win_add, but
it is only deleted from hostwin_list in vfio_host_win_del, which causes
a memory leak.  Also, freeing all elements in hostwin_list is missing in
vfio_disconnect_container.

Fix: 2e4109de8e58 ("vfio/spapr: Create DMA window dynamically (SPAPR IOMMU v2)")
CC: qemu-stable@nongnu.org
Signed-off-by: Peng Liang <liangpeng10@huawei.com>
Link: https://lore.kernel.org/r/20211117014739.1839263-1-liangpeng10@huawei.com
Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
---
 hw/vfio/common.c |    8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/hw/vfio/common.c b/hw/vfio/common.c
index dd387b0d3959..080046e3f511 100644
--- a/hw/vfio/common.c
+++ b/hw/vfio/common.c
@@ -551,6 +551,7 @@ static int vfio_host_win_del(VFIOContainer *container, hwaddr min_iova,
     QLIST_FOREACH(hostwin, &container->hostwin_list, hostwin_next) {
         if (hostwin->min_iova == min_iova && hostwin->max_iova == max_iova) {
             QLIST_REMOVE(hostwin, hostwin_next);
+            g_free(hostwin);
             return 0;
         }
     }
@@ -2239,6 +2240,7 @@ static void vfio_disconnect_container(VFIOGroup *group)
     if (QLIST_EMPTY(&container->group_list)) {
         VFIOAddressSpace *space = container->space;
         VFIOGuestIOMMU *giommu, *tmp;
+        VFIOHostDMAWindow *hostwin, *next;
 
         QLIST_REMOVE(container, next);
 
@@ -2249,6 +2251,12 @@ static void vfio_disconnect_container(VFIOGroup *group)
             g_free(giommu);
         }
 
+        QLIST_FOREACH_SAFE(hostwin, &container->hostwin_list, hostwin_next,
+                           next) {
+            QLIST_REMOVE(hostwin, hostwin_next);
+            g_free(hostwin);
+        }
+
         trace_vfio_disconnect_container(container->fd);
         close(container->fd);
         g_free(container);




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

* Re: [PULL 0/1] VFIO fixes 2021-11-17 (for v6.2)
  2021-11-17 19:17 [PULL 0/1] VFIO fixes 2021-11-17 (for v6.2) Alex Williamson
  2021-11-17 19:17 ` [PULL 1/1] vfio: Fix memory leak of hostwin Alex Williamson
@ 2021-11-18 10:13 ` Richard Henderson
  1 sibling, 0 replies; 3+ messages in thread
From: Richard Henderson @ 2021-11-18 10:13 UTC (permalink / raw)
  To: Alex Williamson, qemu-devel; +Cc: liangpeng10

On 11/17/21 8:17 PM, Alex Williamson wrote:
> The following changes since commit 3bb87484e77d22cf4e580a78856529c982195d32:
> 
>    Merge tag 'pull-request-2021-11-17' of https://gitlab.com/thuth/qemu into staging (2021-11-17 12:35:51 +0100)
> 
> are available in the Git repository at:
> 
>    git://github.com/awilliam/qemu-vfio.git tags/vfio-fixes-20211117.0
> 
> for you to fetch changes up to f3bc3a73c908df15966e66f88d5a633bd42fd029:
> 
>    vfio: Fix memory leak of hostwin (2021-11-17 11:25:55 -0700)
> 
> ----------------------------------------------------------------
> VFIO fixes 2021-11-17
> 
>   * Fix hostwin memory leak (Peng Liang)
> 
> ----------------------------------------------------------------
> Peng Liang (1):
>        vfio: Fix memory leak of hostwin
> 
>   hw/vfio/common.c | 8 ++++++++
>   1 file changed, 8 insertions(+)

Applied, thanks.

r~


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

end of thread, other threads:[~2021-11-18 10:15 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-17 19:17 [PULL 0/1] VFIO fixes 2021-11-17 (for v6.2) Alex Williamson
2021-11-17 19:17 ` [PULL 1/1] vfio: Fix memory leak of hostwin Alex Williamson
2021-11-18 10:13 ` [PULL 0/1] VFIO fixes 2021-11-17 (for v6.2) Richard Henderson

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