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] [xen-unstable] x86 pmstat: Fix get_pm_info hypercall arg

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] x86 pmstat: Fix get_pm_info hypercall argument checking.
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Thu, 25 Sep 2008 20:20:15 -0700
Delivery-date: Thu, 25 Sep 2008 20:20:45 -0700
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/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/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 Keir Fraser <keir.fraser@xxxxxxxxxx>
# Date 1222333937 -3600
# Node ID d4a093819310b70f24dfdc986755588ed5581a6e
# Parent  50170dc8649cb43630f067eb9b2db3ce3f9c6db4
x86 pmstat: Fix get_pm_info hypercall argument checking.

Signed-off-by: Lu Guanqun <guanqun.lu@xxxxxxxxx>
Signed-off-by: Keir Fraser <keir.fraser@xxxxxxxxxx>
---
 xen/arch/x86/acpi/pmstat.c |   24 ++++++++++++++++++------
 1 files changed, 18 insertions(+), 6 deletions(-)

diff -r 50170dc8649c -r d4a093819310 xen/arch/x86/acpi/pmstat.c
--- a/xen/arch/x86/acpi/pmstat.c        Thu Sep 25 10:03:04 2008 +0100
+++ b/xen/arch/x86/acpi/pmstat.c        Thu Sep 25 10:12:17 2008 +0100
@@ -36,6 +36,7 @@
 #include <xen/cpumask.h>
 #include <asm/processor.h>
 #include <xen/percpu.h>
+#include <xen/domain.h>
 
 #include <public/sysctl.h>
 #include <acpi/cpufreq/cpufreq.h>
@@ -51,15 +52,26 @@ int do_get_pm_info(struct xen_sysctl_get
     int ret = 0;
     const struct processor_pminfo *pmpt = processor_pminfo[op->cpuid];
 
-    /* to protect the case when Px was not controlled by xen */
-    if ( (!pmpt || !(pmpt->perf.init & XEN_PX_INIT)) &&
-        (op->type & PMSTAT_CATEGORY_MASK) == PMSTAT_PX )
+    if ( (op->cpuid >= NR_CPUS) || !cpu_online(op->cpuid) )
         return -EINVAL;
 
-    if ( op->cpuid >= NR_CPUS || !cpu_online(op->cpuid) )
-        return -EINVAL;
+    switch ( op->type & PMSTAT_CATEGORY_MASK )
+    {
+    case PMSTAT_CX:
+        if ( !(xen_processor_pmbits & XEN_PROCESSOR_PM_CX) )
+            return -ENODEV;
+        break;
+    case PMSTAT_PX:
+        if ( !(xen_processor_pmbits & XEN_PROCESSOR_PM_PX) )
+            return -ENODEV;
+        if ( !pmpt || !(pmpt->perf.init & XEN_PX_INIT) )
+            return -EINVAL;
+        break;
+    default:
+        return -ENODEV;
+    }
 
-    switch( op->type )
+    switch ( op->type )
     {
     case PMSTAT_get_max_px:
     {

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] x86 pmstat: Fix get_pm_info hypercall argument checking., Xen patchbot-unstable <=