WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-changelog

[Xen-changelog] In all cases in dom0_ops.c, return EFAULT if copy_user

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] In all cases in dom0_ops.c, return EFAULT if copy_user
From: Xen patchbot -unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Sat, 10 Dec 2005 15:58:06 +0000
Delivery-date: Mon, 12 Dec 2005 11:37:01 +0000
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kaf24@xxxxxxxxxxxxxxxxxxxx
# Node ID 82e283d25f3c16f03fcdababf16ee84cef329be6
# Parent  1712c7882f7efbb8a48be4c6ae1643baed98db4d
In all cases in dom0_ops.c, return EFAULT if copy_user
fails.

Signed-off-by: Anthony Liguori <aliguori@xxxxxxxxxx>

diff -r 1712c7882f7e -r 82e283d25f3c xen/common/dom0_ops.c
--- a/xen/common/dom0_ops.c     Sat Dec 10 00:11:33 2005
+++ b/xen/common/dom0_ops.c     Sat Dec 10 14:54:27 2005
@@ -216,7 +216,8 @@
         ret = 0;
 
         op->u.createdomain.domain = d->domain_id;
-        copy_to_user(u_dom0_op, op, sizeof(*op));
+        if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )
+            ret = -EFAULT;
     }
     break;
 
@@ -341,14 +342,16 @@
     case DOM0_SCHEDCTL:
     {
         ret = sched_ctl(&op->u.schedctl);
-        copy_to_user(u_dom0_op, op, sizeof(*op));
+        if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )
+            ret = -EFAULT;
     }
     break;
 
     case DOM0_ADJUSTDOM:
     {
         ret = sched_adjdom(&op->u.adjustdom);
-        copy_to_user(u_dom0_op, op, sizeof(*op));
+        if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )
+            ret = -EFAULT;
     }
     break;
 
@@ -376,7 +379,7 @@
         getdomaininfo(d, &op->u.getdomaininfo);
 
         if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )     
-            ret = -EINVAL;
+            ret = -EFAULT;
 
         put_domain(d);
     }
@@ -411,7 +414,7 @@
 
             if ( copy_to_user(buffer, &info, sizeof(dom0_getdomaininfo_t)) )
             {
-                ret = -EINVAL;
+                ret = -EFAULT;
                 break;
             }
             
@@ -427,7 +430,7 @@
         op->u.getdomaininfolist.num_domains = num_domains;
 
         if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )
-            ret = -EINVAL;
+            ret = -EFAULT;
     }
     break;
 
@@ -520,7 +523,8 @@
     case DOM0_TBUFCONTROL:
     {
         ret = tb_control(&op->u.tbufcontrol);
-        copy_to_user(u_dom0_op, op, sizeof(*op));
+        if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )
+            ret = -EFAULT;
     }
     break;
     
@@ -530,15 +534,18 @@
             &op->u.readconsole.buffer, 
             &op->u.readconsole.count,
             op->u.readconsole.clear); 
-        copy_to_user(u_dom0_op, op, sizeof(*op));
+        if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )
+            ret = -EFAULT;
     }
     break;
 
     case DOM0_SCHED_ID:
     {
         op->u.sched_id.sched_id = sched_id();
-        copy_to_user(u_dom0_op, op, sizeof(*op));
-        ret = 0;        
+        if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )
+            ret = -EFAULT;
+        else
+            ret = 0;
     }
     break;
 
@@ -576,7 +583,8 @@
     {
         extern int perfc_control(dom0_perfccontrol_t *);
         ret = perfc_control(&op->u.perfccontrol);
-        copy_to_user(u_dom0_op, op, sizeof(*op));
+        if ( copy_to_user(u_dom0_op, op, sizeof(*op)) )
+            ret = -EFAULT;
     }
     break;
 #endif

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] In all cases in dom0_ops.c, return EFAULT if copy_user, Xen patchbot -unstable <=