$NetBSD: patch-CVE-2013-1920,v 1.1.2.2 2013/04/24 22:25:48 tron Exp $

http://lists.xen.org/archives/html/xen-announce/2013-04/msg00000.html

--- xen/common/event_channel.c.orig
+++ xen/common/event_channel.c
@@ -104,7 +104,6 @@ static int get_free_port(struct domain *
     if ( unlikely(chn == NULL) )
         return -ENOMEM;
     memset(chn, 0, EVTCHNS_PER_BUCKET * sizeof(*chn));
-    bucket_from_port(d, port) = chn;
 
     for ( i = 0; i < EVTCHNS_PER_BUCKET; i++ )
     {
@@ -117,6 +116,8 @@ static int get_free_port(struct domain *
         }
     }
 
+    bucket_from_port(d, port) = chn;
+
     return port;
 }
 
