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