From: Andrew Cooper Date: Mon, 12 Dec 2016 18:12:54 +0000 (+0000) Subject: x86/hvm: Fix HVMOP_get_param when skipping creating the default ioreq server X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~3179 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=451c9938c68ccb77ff94765f7ac47e8de51d3f43;p=xen.git x86/hvm: Fix HVMOP_get_param when skipping creating the default ioreq server 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 Reviewed-by: Jan Beulich Reviewed-by: Paul Durrant --- diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 2b3977a303..61f5029858 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -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];