Merge "msm-core: Ensure the userspace data is copied before access"

This commit is contained in:
Linux Build Service Account 2017-10-11 22:43:12 -07:00 committed by Gerrit - the friendly Code Review server
commit 65e178a26d
1 changed files with 9 additions and 5 deletions

View File

@ -350,10 +350,14 @@ static int update_userspace_power(struct sched_params __user *argp)
int cpu;
struct cpu_activity_info *node;
struct cpu_static_info *sp, *clear_sp;
int mpidr = (argp->cluster << 8);
int cpumask = argp->cpumask;
int cpumask, cluster, mpidr;
pr_debug("cpumask %d, cluster: %d\n", argp->cpumask, argp->cluster);
get_user(cpumask, &argp->cpumask);
get_user(cluster, &argp->cluster);
mpidr = cluster << 8;
pr_debug("%s: cpumask %d, cluster: %d\n", __func__, cpumask,
cluster);
for (i = 0; i < MAX_CORES_PER_CLUSTER; i++, cpumask >>= 1) {
if (!(cpumask & 0x01))
continue;
@ -398,11 +402,11 @@ static int update_userspace_power(struct sched_params __user *argp)
* argp->cpumask within the cluster (argp->cluster)
*/
spin_lock(&update_lock);
cpumask = argp->cpumask;
get_user(cpumask, &argp->cpumask);
for (i = 0; i < MAX_CORES_PER_CLUSTER; i++, cpumask >>= 1) {
if (!(cpumask & 0x01))
continue;
mpidr = (argp->cluster << CLUSTER_OFFSET_FOR_MPIDR);
mpidr = (cluster << CLUSTER_OFFSET_FOR_MPIDR);
mpidr |= i;
for_each_possible_cpu(cpu) {
if (!(cpu_logical_map(cpu) == mpidr))