Re: [PATCHv2] qemu: fix crash in migrate when migrateuri do not have a scheme

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

 




On 02/11/2015 08:22 PM, Ján Tomko wrote:
I have changed the summary to:
qemu: fix crash when migrateuri has no scheme

On Wed, Feb 11, 2015 at 04:30:32PM +0800, Luyao Huang wrote:
https://bugzilla.redhat.com/show_bug.cgi?id=1191355

When we migrate a vm with migrateuri option with a uri do not
have scheme like this:

I reworded it as:
When we attempt to migrate a vm with a migrateuri that has no scheme:

  # virsh migrate test4 --live qemu+ssh://lhuang/system --migrateuri 127.0.0.1

target libvirtd will crashed because uri->scheme is NULL in
s/crashed/crash/

qemuMigrationPrepareDirect this line:
s/this line/on this line/

      if (STRNEQ(uri->scheme, "tcp") &&

add a value check before this line. Also fix a place like this in
s/place/bug/

doNativeMigrate.
that could only happen when destination libvirtd returned an incorrect
URI.

Signed-off-by: Luyao Huang <lhuang@xxxxxxxxxx>
---
  src/qemu/qemu_migration.c | 14 ++++++++++++++
  1 file changed, 14 insertions(+)

diff --git a/src/qemu/qemu_migration.c b/src/qemu/qemu_migration.c
index 879b1bf..d4ffe6c 100644
--- a/src/qemu/qemu_migration.c
+++ b/src/qemu/qemu_migration.c
@@ -3281,6 +3281,13 @@ qemuMigrationPrepareDirect(virQEMUDriverPtr driver,
          if (!(uri = qemuMigrationParseURI(uri_in, &well_formed_uri)))
              goto cleanup;
+ if (uri->scheme == NULL) {
+            virReportError(VIR_ERR_INVALID_ARG,
+                           _("missing scheme in migration URI: %s"),
+                           uri_in);
+            goto cleanup;
+        }
+
          if (STRNEQ(uri->scheme, "tcp") &&
              STRNEQ(uri->scheme, "rdma")) {
              virReportError(VIR_ERR_ARGUMENT_UNSUPPORTED,
@@ -4083,6 +4090,13 @@ static int doNativeMigrate(virQEMUDriverPtr driver,
      if (!(uribits = qemuMigrationParseURI(uri, NULL)))
          return -1;
+ if (uribits->scheme == NULL) {
+        virReportError(VIR_ERR_INVALID_ARG,
I changed this to INTERNAL_ERROR, because it would be libvirtd's fault
if this happened and pushed the patch.

Thanks for your reword and review
Jan

Luyao

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]