From: Andrew Cooper Date: Fri, 17 Feb 2017 11:53:44 +0000 (+0000) Subject: common/vcpu: Fix unintended breakage from cleanup X-Git-Tag: archive/raspbian/4.11.1-1+rpi1~1^2~66^2~2754 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=cc6d98d5454b9d289a9e80d71c215da148a09b38;p=xen.git common/vcpu: Fix unintended breakage from cleanup c/s 3044a2a "common/vcpu: Switch v->vcpu_info_mfn to mfn_t" was intended to be no functional change. Unfortunately, because vcpu_info_reset() clobbers v->vcpu_info_mfn, the change ended up calling put_page_and_type() on MFN_INVALID. Reintroduce the local variable, and leave a comment behind. Signed-off-by: Andrew Cooper Reviewed-by: Jan Beulich --- diff --git a/xen/common/domain.c b/xen/common/domain.c index 0c52831eac..4492c9c3d5 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -1211,15 +1211,17 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset) */ void unmap_vcpu_info(struct vcpu *v) { - if ( mfn_eq(v->vcpu_info_mfn, INVALID_MFN) ) + mfn_t mfn = v->vcpu_info_mfn; + + if ( mfn_eq(mfn, INVALID_MFN) ) return; unmap_domain_page_global((void *) ((unsigned long)v->vcpu_info & PAGE_MASK)); - vcpu_info_reset(v); + vcpu_info_reset(v); /* NB: Clobbers v->vcpu_info_mfn */ - put_page_and_type(mfn_to_page(mfn_x(v->vcpu_info_mfn))); + put_page_and_type(mfn_to_page(mfn_x(mfn))); } int default_initialise_vcpu(struct vcpu *v, XEN_GUEST_HANDLE_PARAM(void) arg)