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-ppc-devel

[XenPPC] [linux-ppc-2.6] Fix potential xencomm memory leaks in the kerne

To: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Subject: [XenPPC] [linux-ppc-2.6] Fix potential xencomm memory leaks in the kernel's hypercall translation paths.
From: "Xen patchbot-linux-ppc-2.6" <patchbot-linux-ppc-2.6@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 01 Mar 2007 08:40:38 -0800
Delivery-date: Thu, 01 Mar 2007 09:03:30 -0800
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-ppc-devel-request@lists.xensource.com?subject=help>
List-id: Xen PPC development <xen-ppc-devel.lists.xensource.com>
List-post: <mailto:xen-ppc-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-ppc-devel>, <mailto:xen-ppc-devel-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-ppc-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-ppc-devel-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User Hollis Blanchard <hollisb@xxxxxxxxxx>
# Date 1172766459 21600
# Node ID 3e512eaf2a6f0f740331bc891fbc0a29392a2794
# Parent  1abaceb1e6e8858b3929d5d6fd20fc3192f47e33
Fix potential xencomm memory leaks in the kernel's hypercall translation paths.
Signed-off-by: Jerone Young <jyoung5@xxxxxxxxxx>
Signed-off-by: Hollis Blanchard <hollisb@xxxxxxxxxx>
---
 arch/powerpc/platforms/xen/hcall.c |   28 +++++++++++++++-------------
 1 files changed, 15 insertions(+), 13 deletions(-)

diff -r 1abaceb1e6e8 -r 3e512eaf2a6f arch/powerpc/platforms/xen/hcall.c
--- a/arch/powerpc/platforms/xen/hcall.c        Thu Mar 01 10:11:53 2007 -0600
+++ b/arch/powerpc/platforms/xen/hcall.c        Thu Mar 01 10:27:39 2007 -0600
@@ -160,7 +160,7 @@ int HYPERVISOR_sched_op(int cmd, void *a
 int HYPERVISOR_sched_op(int cmd, void *arg)
 {
        int argsize = 0;
-       int rc;
+       int rc = -EINVAL;
        void *desc;
        evtchn_port_t *ports = NULL;
 
@@ -202,12 +202,11 @@ int HYPERVISOR_sched_op(int cmd, void *a
        }
 
        desc = xencomm_map_no_alloc(arg, argsize); 
-
-       if (desc == NULL)
-               return -EINVAL;
-
-       rc = plpar_hcall_norets(XEN_MARK(__HYPERVISOR_sched_op),
-                               cmd, desc);
+       if (desc) {
+               rc = plpar_hcall_norets(XEN_MARK(__HYPERVISOR_sched_op),
+                                       cmd, desc);
+               xencomm_free(desc);
+       }
 
        xencomm_free(ports);
 
@@ -389,8 +388,8 @@ static int xenppc_privcmd_domctl(privcmd
        if (copy_to_user(user_op, &kern_op, sizeof(xen_domctl_t)))
                ret = -EFAULT;
 
-       xencomm_free(desc);
 out:
+       xencomm_free(desc);
        xencomm_free(op_desc);
        return ret;
 }
@@ -463,8 +462,8 @@ static int xenppc_privcmd_sysctl(privcmd
        if (copy_to_user(user_op, &kern_op, sizeof(xen_sysctl_t)))
                ret = -EFAULT;
 
-       xencomm_free(desc);
 out:
+       xencomm_free(desc);
        xencomm_free(op_desc);
        return ret;
 }
@@ -514,8 +513,8 @@ static int xenppc_privcmd_platform_op(pr
        if (copy_to_user(user_op, &kern_op, sizeof(xen_platform_op_t)))
                ret = -EFAULT;
 
-       xencomm_free(desc);
 out:
+       xencomm_free(desc);
        xencomm_free(op_desc);
        return ret;
 }
@@ -546,8 +545,10 @@ int HYPERVISOR_memory_op(unsigned int cm
                                mop->nr_extents *
                                sizeof(*xen_guest_handle(mop->extent_start)));
 
-                       if (desc == NULL)
-                               return -ENOMEM;
+                       if (desc == NULL) {
+                               ret = -ENOMEM;
+                               goto out;
+                       }
 
                        set_xen_guest_handle(mop->extent_start,
                                             desc);
@@ -569,9 +570,10 @@ int HYPERVISOR_memory_op(unsigned int cm
                printk(KERN_ERR "%s: unknown memory op %d\n", __func__, cmd);
                ret = -ENOSYS;
        }
+
+out:
        xencomm_free(op_desc);
        return ret;
-
 }
 EXPORT_SYMBOL(HYPERVISOR_memory_op);
 

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

<Prev in Thread] Current Thread [Next in Thread>
  • [XenPPC] [linux-ppc-2.6] Fix potential xencomm memory leaks in the kernel's hypercall translation paths., Xen patchbot-linux-ppc-2.6 <=