All of lore.kernel.org
 help / color / mirror / Atom feed
From: Li Qiang <liq3ea@gmail.com>
To: groug@kaod.org
Cc: qemu-devel@nongnu.org, ppandit@redhat.com, Li Qiang <liqiang6-s@360.cn>
Subject: [Qemu-devel] [PATCH] 9pfs: fix migration_block leak
Date: Thu, 30 Mar 2017 05:27:14 -0700	[thread overview]
Message-ID: <1490876834-61392-1-git-send-email-liqiang6-s@360.cn> (raw)

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 <liqiang6-s@360.cn>
---
 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	other threads:[~2017-03-30 12:27 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-30 12:27 Li Qiang [this message]
2017-03-30 13:25 ` [Qemu-devel] [PATCH for-2.9?] 9pfs: fix migration_block leak Eric Blake
2017-03-30 15:46   ` Greg Kurz
2017-03-31  1:26     ` Li Qiang
2017-03-31  7:07       ` Greg Kurz
2017-03-31  8:01         ` Li Qiang
2017-03-31  8:37           ` Greg Kurz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1490876834-61392-1-git-send-email-liqiang6-s@360.cn \
    --to=liq3ea@gmail.com \
    --cc=groug@kaod.org \
    --cc=liqiang6-s@360.cn \
    --cc=ppandit@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.