qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PATCH] 9pfs: fix migration_block leak


From: Li Qiang
Subject: [Qemu-devel] [PATCH] 9pfs: fix migration_block leak
Date: Thu, 30 Mar 2017 05:27:14 -0700

The guest can leave the pdu->s->migration_blocker exists by attach
but not remove a fid. Then if we hot unplug the 9pfs device, the
v9fs_reset() just free the fids, but not free the migration_blocker.
This will leak a memory leak. This patch avoid this.

Signed-off-by: Li Qiang <address@hidden>
---
 hw/9pfs/9p.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c
index 48babce..b55c02d 100644
--- a/hw/9pfs/9p.c
+++ b/hw/9pfs/9p.c
@@ -548,6 +548,12 @@ static void coroutine_fn virtfs_reset(V9fsPDU *pdu)
             free_fid(pdu, fidp);
         }
     }
+
+    if (pdu->s->migration_blocker) {
+        migrate_del_blocker(pdu->s->migration_blocker);
+        error_free(pdu->s->migration_blocker);
+        pdu->s->migration_blocker = NULL;
+    }
 }
 
 #define P9_QID_TYPE_DIR         0x80
-- 
1.8.3.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]