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

[Xen-devel] [PATCH] 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 <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
---
 xen/common/domain.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/xen/common/domain.c b/xen/common/domain.c
index 0c52831..4492c9c 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)
-- 
2.1.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.