]> xenbits.xensource.com Git - xen.git/commitdiff
x86: properly check XEN_DOMCTL_ioport_mapping arguments for invalid range
authorJan Beulich <jbeulich@suse.com>
Wed, 19 Sep 2012 07:27:55 +0000 (09:27 +0200)
committerJan Beulich <jbeulich@suse.com>
Wed, 19 Sep 2012 07:27:55 +0000 (09:27 +0200)
In particular, the case of "np" being a very large value wasn't handled
correctly. The range start checks also were off by one (except that in
practice, when "np" is properly range checked, this would still have
been caught by the range end checks).

Also, is a GFN wrap in XEN_DOMCTL_memory_mapping really okay?

Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
xen/arch/x86/domctl.c

index f4e57051e00f17af21a520b9d3e1d118231dd010..c7f3965b702c46daf4bccaab02212059bb923a11 100644 (file)
@@ -884,7 +884,7 @@ long arch_do_domctl(
         int found = 0;
 
         ret = -EINVAL;
-        if ( (np == 0) || (fgp > MAX_IOPORTS) || (fmp > MAX_IOPORTS) ||
+        if ( ((fgp | fmp | (np - 1)) >= MAX_IOPORTS) ||
             ((fgp + np) > MAX_IOPORTS) || ((fmp + np) > MAX_IOPORTS) )
         {
             printk(XENLOG_G_ERR