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

[Xen-devel] [PATCH] x86: fix error handling in MTRR code



Signed-off-by: Jan Beulich <jbeulich@xxxxxxxxxx>

Index: 2006-09-21/xen/arch/x86/platform_hypercall.c
===================================================================
--- 2006-09-21.orig/xen/arch/x86/platform_hypercall.c   2006-08-28 
08:32:37.000000000 +0200
+++ 2006-09-21/xen/arch/x86/platform_hypercall.c        2006-09-27 
17:14:22.000000000 +0200
@@ -58,12 +58,17 @@ long do_platform_op(XEN_GUEST_HANDLE(xen
             op->u.add_memtype.nr_mfns,
             op->u.add_memtype.type,
             1);
-        if ( ret > 0 )
+        if ( ret >= 0 )
         {
             op->u.add_memtype.handle = 0;
             op->u.add_memtype.reg    = ret;
-            (void)copy_to_guest(u_xenpf_op, op, 1);
-            ret = 0;
+            if ( copy_to_guest(u_xenpf_op, op, 1) == 0 )
+                ret = 0;
+            else
+            {
+                mtrr_del_page(ret, 0, 0);
+                ret = -EFAULT;
+            }
         }
     }
     break;
@@ -96,8 +101,10 @@ long do_platform_op(XEN_GUEST_HANDLE(xen
             op->u.read_memtype.mfn     = mfn;
             op->u.read_memtype.nr_mfns = nr_mfns;
             op->u.read_memtype.type    = type;
-            (void)copy_to_guest(u_xenpf_op, op, 1);
-            ret = 0;
+            if ( copy_to_guest(u_xenpf_op, op, 1) == 0 )
+                ret = 0;
+            else
+                ret = -EFAULT;
         }
     }
     break;


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


 


Rackspace

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