Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 03187552 authored by Linus Torvalds's avatar Linus Torvalds
Browse files

Merge branch 'timers-fixes-for-linus' of...

Merge branch 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip

* 'timers-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/linux-2.6-tip:
  posix-cpu-timers: Rcu_read_lock/unlock protect find_task_by_vpid call
parents fbe6c404 c0deae8c
Loading
Loading
Loading
Loading
+6 −6
Original line number Original line Diff line number Diff line
@@ -37,13 +37,13 @@ static int check_clock(const clockid_t which_clock)
	if (pid == 0)
	if (pid == 0)
		return 0;
		return 0;


	read_lock(&tasklist_lock);
	rcu_read_lock();
	p = find_task_by_vpid(pid);
	p = find_task_by_vpid(pid);
	if (!p || !(CPUCLOCK_PERTHREAD(which_clock) ?
	if (!p || !(CPUCLOCK_PERTHREAD(which_clock) ?
		   same_thread_group(p, current) : thread_group_leader(p))) {
		   same_thread_group(p, current) : has_group_leader_pid(p))) {
		error = -EINVAL;
		error = -EINVAL;
	}
	}
	read_unlock(&tasklist_lock);
	rcu_read_unlock();


	return error;
	return error;
}
}
@@ -390,7 +390,7 @@ int posix_cpu_timer_create(struct k_itimer *new_timer)


	INIT_LIST_HEAD(&new_timer->it.cpu.entry);
	INIT_LIST_HEAD(&new_timer->it.cpu.entry);


	read_lock(&tasklist_lock);
	rcu_read_lock();
	if (CPUCLOCK_PERTHREAD(new_timer->it_clock)) {
	if (CPUCLOCK_PERTHREAD(new_timer->it_clock)) {
		if (pid == 0) {
		if (pid == 0) {
			p = current;
			p = current;
@@ -404,7 +404,7 @@ int posix_cpu_timer_create(struct k_itimer *new_timer)
			p = current->group_leader;
			p = current->group_leader;
		} else {
		} else {
			p = find_task_by_vpid(pid);
			p = find_task_by_vpid(pid);
			if (p && !thread_group_leader(p))
			if (p && !has_group_leader_pid(p))
				p = NULL;
				p = NULL;
		}
		}
	}
	}
@@ -414,7 +414,7 @@ int posix_cpu_timer_create(struct k_itimer *new_timer)
	} else {
	} else {
		ret = -EINVAL;
		ret = -EINVAL;
	}
	}
	read_unlock(&tasklist_lock);
	rcu_read_unlock();


	return ret;
	return ret;
}
}