/* The only thing that can change the capabilities of the current process is the current process. As such, we can't be in this code at the same time as we are in the process of setting capabilities in this process. The net result is that we can limit our use of locks to when we are reading the caps of another process.  */
static int cap_get_target_pid(pid_t pid, kernel_cap_t *pEp, kernel_cap_t *pIp, kernel_cap_t *pPp)
/* The only thing that can change the capabilities of the current process is the current process. As such, we can't be in this code at the same time as we are in the process of setting capabilities in this process. The net result is that we can limit our use of locks to when we are reading the caps of another process.  */
static int cap_get_target_pid(pid_t pid, kernel_cap_t *pEp, kernel_cap_t *pIp, kernel_cap_t *pPp)
{
	int ret;
	if (pid && (pid != task_pid_vnr(current))) {
		struct task_struct *target;
		read_lock(&tasklist_lock);
		target = find_task_by_vpid(pid);
		if (!target)
			ret = -ESRCH;
		else
			ret = security_capget(target, pEp, pIp, pPp);
		read_unlock(&tasklist_lock);
	} else
		ret = security_capget(current, pEp, pIp, pPp);
	return ret;
}