Skip to content

Commit

Permalink
ACPI : Check parameter when calling acpi_processor_get/set_throttling
Browse files Browse the repository at this point in the history
It is necessary to check the parameter when calling the function of
acpi_processor_get/set_throttling function so as to avoid the NULL
pointer reference in pr or throttling.

http://bugzilla.kernel.org/show_bug.cgi?id=9747

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Signed-off-by: Len Brown <len.brown@intel.com>
  • Loading branch information
Zhao Yakui authored and Len Brown committed Feb 2, 2008
1 parent 3abbd33 commit 8765427
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions drivers/acpi/processor_throttling.c
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,11 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr)
cpumask_t saved_mask;
int ret;

if (!pr)
return -EINVAL;

if (!pr->flags.throttling)
return -ENODEV;
/*
* Migrate task to the cpu pointed by pr.
*/
Expand Down Expand Up @@ -743,6 +748,16 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state)
{
cpumask_t saved_mask;
int ret;

if (!pr)
return -EINVAL;

if (!pr->flags.throttling)
return -ENODEV;

if ((state < 0) || (state > (pr->throttling.state_count - 1)))
return -EINVAL;

/*
* Migrate task to the cpu pointed by pr.
*/
Expand Down

0 comments on commit 8765427

Please sign in to comment.