]> xenbits.xensource.com Git - xen.git/commitdiff
xen/domain: Call lock_profile_deregister_struct() from common code
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 3 Sep 2018 11:10:48 +0000 (12:10 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 4 Sep 2018 12:25:44 +0000 (13:25 +0100)
lock_profile_register_struct() is called from common code, but the matching
deregister was previously only called from x86 code.

The practical upshot of this when using CONFIG_LOCK_PROFILE, destroyed domains
on ARM (and in particular, the freed page behind struct domain) remain on the
lockprofile linked list, which will become corrupt when the page is reused.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Wei Liu <wei.liu2@citrix.com>
xen/arch/x86/domain.c
xen/common/domain.c

index 688f7fbc4ee671fa4ceb7615fa17d706f1807e1b..cd1419e7402c81d1aeb8bf21cc2594a6cfe1b90c 100644 (file)
@@ -298,7 +298,6 @@ struct domain *alloc_domain_struct(void)
 
 void free_domain_struct(struct domain *d)
 {
-    lock_profile_deregister_struct(LOCKPROF_TYPE_PERDOM, d);
     free_xenheap_page(d);
 }
 
index b0988763a3b5ca6d8217a96ce843e29c4885074a..2fcb35b082609c5d90ed54f98a066cdce189e7f9 100644 (file)
@@ -274,6 +274,8 @@ static void _domain_destroy(struct domain *d)
 
     free_cpumask_var(d->dirty_cpumask);
 
+    lock_profile_deregister_struct(LOCKPROF_TYPE_PERDOM, d);
+
     free_domain_struct(d);
 }