common/vcpu: Fix unintended breakage from cleanup
PATCH 1/1 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.
---
CC: Jan Beulich <[email protected]>
--- xen/common/domain.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
xen/common/domain.c +5 -3
@@ -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)
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xen.org/xen-devel
Quoted 10 lines
Quoted 1 line
Quoted 1 line · On 17.02.17 at 12:56, <[email protected]> wrote:
c/s 3044a2a "common/vcpu: Switch
v->vcpu_info_mfntomfn_t" was intended to be no functional change.Unfortunately, because
vcpu_info_reset()clobbersv->vcpu_info_mfn, the change ended up callingput_page_and_type()onMFN_INVALID.Reintroduce the local variable, and leave a comment behind.
Signed-off-by Andrew Cooper <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xen.org/xen-devel