msm: thermal: validate userspace args to prevent buffer overflow.

Prevent a userspace ioctl variable from accessing an array out of
bounds.

BUG: 27243728
Change-Id: I43690364273ace4a22e214bab88c76f0749c6d4f
This commit is contained in:
Nick Desaulniers 2016-02-17 16:08:47 -08:00 committed by syphyr
parent 26348f7fa6
commit 78ef5ad5fb
1 changed files with 10 additions and 0 deletions

View File

@ -100,6 +100,16 @@ static long validate_and_copy(unsigned int *cmd, unsigned long *arg,
goto validate_exit;
}
break;
case MSM_THERMAL_GET_CLUSTER_FREQUENCY_PLAN:
if (query->clock_freq.cluster_num >= NR_CPUS) {
ret = -EINVAL;
goto validate_exit;
}
case MSM_THERMAL_GET_CLUSTER_VOLTAGE_PLAN:
if (query->voltage.cluster_num >= NR_CPUS) {
ret = -EINVAL;
goto validate_exit;
}
default:
break;
}