defer event channel bucket pointer store until after XSM checks
authorJan Beulich <jbeulich@suse.com>
Fri, 5 Apr 2013 07:59:03 +0000 (09:59 +0200)
committerJan Beulich <jbeulich@suse.com>
Fri, 5 Apr 2013 07:59:03 +0000 (09:59 +0200)
Otherwise a dangling pointer can be left, which would cause subsequent
memory corruption as soon as the space got re-allocated for some other
purpose.

This is CVE-2013-1920 / XSA-47.

Reported-by: Wei Liu <wei.liu2@citrix.com>
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Tim Deegan <tim@xen.org>
xen/common/event_channel.c

index a0f293ff2ef56c5456d5449618dbf1cf068ecec0..0a6684c6d57568b08e2fef30d38157ba905a0002 100644 (file)
@@ -140,7 +140,6 @@ static int get_free_port(struct domain *d)
     chn = xzalloc_array(struct evtchn, EVTCHNS_PER_BUCKET);
     if ( unlikely(chn == NULL) )
         return -ENOMEM;
-    bucket_from_port(d, port) = chn;
 
     for ( i = 0; i < EVTCHNS_PER_BUCKET; i++ )
     {
@@ -153,6 +152,8 @@ static int get_free_port(struct domain *d)
         }
     }
 
+    bucket_from_port(d, port) = chn;
+
     return port;
 }