qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 0/1] Migration 20231201 patches
@ 2023-12-01 16:36 Peter Xu
  2023-12-01 16:36 ` [PULL 1/1] migration: Plug memory leak with migration URIs Peter Xu
  2023-12-04 14:45 ` [PULL 0/1] Migration 20231201 patches Stefan Hajnoczi
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Xu @ 2023-12-01 16:36 UTC (permalink / raw)
  To: qemu-devel, Stefan Hajnoczi
  Cc: Het Gala, peterx, Juan Quintela, Markus Armbruster, Fabiano Rosas,
	Leonardo Bras Soares Passos

The following changes since commit abf635ddfe3242df907f58967f3c1e6763bbca2d:

  Update version for v8.2.0-rc2 release (2023-11-28 16:31:16 -0500)

are available in the Git repository at:

  https://github.com/xzpeter/qemu.git tags/migration-20231201-pull-request

for you to fetch changes up to bc1d54ee51367955b50786323ee5a6bd8c0f0034:

  migration: Plug memory leak with migration URIs (2023-12-01 11:01:28 -0500)

----------------------------------------------------------------
Migration patches for rc3:

- One more memleak regression fix from Het

----------------------------------------------------------------

Het Gala (1):
  migration: Plug memory leak with migration URIs

 migration/migration.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

-- 
2.41.0



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

* [PULL 1/1] migration: Plug memory leak with migration URIs
  2023-12-01 16:36 [PULL 0/1] Migration 20231201 patches Peter Xu
@ 2023-12-01 16:36 ` Peter Xu
  2023-12-04 14:45 ` [PULL 0/1] Migration 20231201 patches Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Peter Xu @ 2023-12-01 16:36 UTC (permalink / raw)
  To: qemu-devel, Stefan Hajnoczi
  Cc: Het Gala, peterx, Juan Quintela, Markus Armbruster, Fabiano Rosas,
	Leonardo Bras Soares Passos

From: Het Gala <het.gala@nutanix.com>

migrate_uri_parse() allocates memory to 'channel' if the user
opts for old syntax - uri, which is leaked because there is no
code for freeing 'channel'.
So, free channel to avoid memory leak in case where 'channels'
is empty and uri parsing is required.

Fixes: 5994024f ("migration: Implement MigrateChannelList to qmp migration flow")
Signed-off-by: Het Gala <het.gala@nutanix.com>
Suggested-by: Markus Armbruster <armbru@redhat.com>
Tested-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
Link: https://lore.kernel.org/r/20231129204301.131228-1-het.gala@nutanix.com
Signed-off-by: Peter Xu <peterx@redhat.com>
---
 migration/migration.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/migration/migration.c b/migration/migration.c
index 28a34c9068..34340f3440 100644
--- a/migration/migration.c
+++ b/migration/migration.c
@@ -515,7 +515,7 @@ static void qemu_start_incoming_migration(const char *uri, bool has_channels,
                                           MigrationChannelList *channels,
                                           Error **errp)
 {
-    MigrationChannel *channel = NULL;
+    g_autoptr(MigrationChannel) channel = NULL;
     MigrationAddress *addr = NULL;
     MigrationIncomingState *mis = migration_incoming_get_current();
 
@@ -533,18 +533,18 @@ static void qemu_start_incoming_migration(const char *uri, bool has_channels,
             error_setg(errp, "Channel list has more than one entries");
             return;
         }
-        channel = channels->value;
+        addr = channels->value->addr;
     } else if (uri) {
         /* caller uses the old URI syntax */
         if (!migrate_uri_parse(uri, &channel, errp)) {
             return;
         }
+        addr = channel->addr;
     } else {
         error_setg(errp, "neither 'uri' or 'channels' argument are "
                    "specified in 'migrate-incoming' qmp command ");
         return;
     }
-    addr = channel->addr;
 
     /* transport mechanism not suitable for migration? */
     if (!migration_channels_and_transport_compatible(addr, errp)) {
@@ -1932,7 +1932,7 @@ void qmp_migrate(const char *uri, bool has_channels,
     bool resume_requested;
     Error *local_err = NULL;
     MigrationState *s = migrate_get_current();
-    MigrationChannel *channel = NULL;
+    g_autoptr(MigrationChannel) channel = NULL;
     MigrationAddress *addr = NULL;
 
     /*
@@ -1949,18 +1949,18 @@ void qmp_migrate(const char *uri, bool has_channels,
             error_setg(errp, "Channel list has more than one entries");
             return;
         }
-        channel = channels->value;
+        addr = channels->value->addr;
     } else if (uri) {
         /* caller uses the old URI syntax */
         if (!migrate_uri_parse(uri, &channel, errp)) {
             return;
         }
+        addr = channel->addr;
     } else {
         error_setg(errp, "neither 'uri' or 'channels' argument are "
                    "specified in 'migrate' qmp command ");
         return;
     }
-    addr = channel->addr;
 
     /* transport mechanism not suitable for migration? */
     if (!migration_channels_and_transport_compatible(addr, errp)) {
-- 
2.41.0



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

* Re: [PULL 0/1] Migration 20231201 patches
  2023-12-01 16:36 [PULL 0/1] Migration 20231201 patches Peter Xu
  2023-12-01 16:36 ` [PULL 1/1] migration: Plug memory leak with migration URIs Peter Xu
@ 2023-12-04 14:45 ` Stefan Hajnoczi
  1 sibling, 0 replies; 3+ messages in thread
From: Stefan Hajnoczi @ 2023-12-04 14:45 UTC (permalink / raw)
  To: Peter Xu
  Cc: qemu-devel, Stefan Hajnoczi, Het Gala, peterx, Juan Quintela,
	Markus Armbruster, Fabiano Rosas, Leonardo Bras Soares Passos

[-- Attachment #1: Type: text/plain, Size: 115 bytes --]

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/8.2 for any user-visible changes.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2023-12-04 14:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-12-01 16:36 [PULL 0/1] Migration 20231201 patches Peter Xu
2023-12-01 16:36 ` [PULL 1/1] migration: Plug memory leak with migration URIs Peter Xu
2023-12-04 14:45 ` [PULL 0/1] Migration 20231201 patches Stefan Hajnoczi

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