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

[Xen-changelog] [xen-unstable] evtchn: Do not free d->poll_mask until domain is being deallocated.



# HG changeset patch
# User Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1261656849 0
# Node ID f03bb5277f04c4ac371936b4765092191c1c1f05
# Parent  dd546bae1029fb52ac5c7aba0bb83c4a6c5537ca
evtchn: Do not free d->poll_mask until domain is being deallocated.

Avoids crash on dereference of poll_mask after domain_kill().

Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/common/domain.c        |    5 +++++
 xen/common/event_channel.c |    7 ++++++-
 xen/include/xen/sched.h    |    5 +++--
 3 files changed, 14 insertions(+), 3 deletions(-)

diff -r dd546bae1029 -r f03bb5277f04 xen/common/domain.c
--- a/xen/common/domain.c       Thu Dec 24 09:10:25 2009 +0000
+++ b/xen/common/domain.c       Thu Dec 24 12:14:09 2009 +0000
@@ -317,7 +317,10 @@ struct domain *domain_create(
     if ( init_status & INIT_gnttab )
         grant_table_destroy(d);
     if ( init_status & INIT_evtchn )
+    {
         evtchn_destroy(d);
+        evtchn_destroy_final(d);
+    }
     if ( init_status & INIT_rangeset )
         rangeset_domain_destroy(d);
     if ( init_status & INIT_xsm )
@@ -606,6 +609,8 @@ static void complete_domain_destroy(stru
     if ( d->target != NULL )
         put_domain(d->target);
 
+    evtchn_destroy_final(d);
+
     xfree(d->pirq_mask);
     xfree(d->pirq_to_evtchn);
 
diff -r dd546bae1029 -r f03bb5277f04 xen/common/event_channel.c
--- a/xen/common/event_channel.c        Thu Dec 24 09:10:25 2009 +0000
+++ b/xen/common/event_channel.c        Thu Dec 24 12:14:09 2009 +0000
@@ -1052,12 +1052,17 @@ void evtchn_destroy(struct domain *d)
         d->evtchn[i] = NULL;
     }
     spin_unlock(&d->event_lock);
-
+}
+
+
+void evtchn_destroy_final(struct domain *d)
+{
 #if MAX_VIRT_CPUS > BITS_PER_LONG
     xfree(d->poll_mask);
     d->poll_mask = NULL;
 #endif
 }
+
 
 static void domain_dump_evtchn_info(struct domain *d)
 {
diff -r dd546bae1029 -r f03bb5277f04 xen/include/xen/sched.h
--- a/xen/include/xen/sched.h   Thu Dec 24 09:10:25 2009 +0000
+++ b/xen/include/xen/sched.h   Thu Dec 24 12:14:09 2009 +0000
@@ -67,8 +67,9 @@ struct evtchn
 #endif
 };
 
-int  evtchn_init(struct domain *d);
-void evtchn_destroy(struct domain *d);
+int  evtchn_init(struct domain *d); /* from domain_create */
+void evtchn_destroy(struct domain *d); /* from domain_kill */
+void evtchn_destroy_final(struct domain *d); /* from complete_domain_destroy */
 
 struct vcpu 
 {

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

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