]> xenbits.xensource.com Git - xen.git/commitdiff
x86/hvm: Fix HVMOP_get_param when skipping creating the default ioreq server
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 12 Dec 2016 18:12:54 +0000 (18:12 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 13 Dec 2016 09:58:33 +0000 (09:58 +0000)
c/s e7dabe5 "x86/hvm: don't unconditionally create a default ioreq server"
added a break statement, but the logic previously depended on falling through
into the default case to fill in the value the caller asked for.

This causes the sending migration code to put a junk PARAM into the stream,
and the receiving side to fail to zero the IOREQ pages, causing QEMU to object
when it finds stale requests while starting up.

Reorder the code so it more clearly falls through into the default case.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Paul Durrant <paul.durrant@citrix.com>
xen/arch/x86/hvm/hvm.c

index 2b3977a303b768957efafa2c9ca48b7079a98f2e..61f5029858c2517f1fd8dce06ad183c3fbd1f089 100644 (file)
@@ -5275,9 +5275,6 @@ static int hvmop_get_param(
     case HVM_PARAM_IOREQ_PFN:
     case HVM_PARAM_BUFIOREQ_PFN:
     case HVM_PARAM_BUFIOREQ_EVTCHN:
-    {
-        domid_t domid;
-
         /*
          * It may be necessary to create a default ioreq server here,
          * because legacy versions of QEMU are not aware of the new API for
@@ -5285,15 +5282,16 @@ static int hvmop_get_param(
          * under construction then it will not be QEMU querying the
          * parameters and thus the query should not have that side-effect.
          */
-        if ( d->creation_finished )
-            break;
+        if ( !d->creation_finished )
+        {
+            domid_t domid = d->arch.hvm_domain.params[HVM_PARAM_DM_DOMAIN];
+
+            rc = hvm_create_ioreq_server(d, domid, 1,
+                                         HVM_IOREQSRV_BUFIOREQ_LEGACY, NULL);
+            if ( rc != 0 && rc != -EEXIST )
+                goto out;
+        }
 
-        domid = d->arch.hvm_domain.params[HVM_PARAM_DM_DOMAIN];
-        rc = hvm_create_ioreq_server(d, domid, 1,
-                                     HVM_IOREQSRV_BUFIOREQ_LEGACY, NULL);
-        if ( rc != 0 && rc != -EEXIST )
-            goto out;
-    }
     /*FALLTHRU*/
     default:
         a.value = d->arch.hvm_domain.params[a.index];