Re: [PATCH 09/14] powerpc/vas: Update CSB and notify process for fault CRBs

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>  
> +static void notify_process(pid_t pid, u64 fault_addr)
> +{
> +	int rc;
> +	struct kernel_siginfo info;
> +
> +	memset(&info, 0, sizeof(info));
> +
> +	info.si_signo = SIGSEGV;
> +	info.si_errno = EFAULT;
> +	info.si_code = SEGV_MAPERR;
> +
> +	info.si_addr = (void *)fault_addr;
> +	rcu_read_lock();
> +	rc = kill_pid_info(SIGSEGV, &info, find_vpid(pid));
> +	rcu_read_unlock();
> +
> +	pr_devel("%s(): pid %d kill_proc_info() rc %d\n", __func__, pid, rc);
> +}

Shouldn't this use force_sig_fault_to_task instead?

> +	/*
> +	 * User space passed invalid CSB address, Notify process with
> +	 * SEGV signal.
> +	 */
> +	tsk = get_pid_task(window->pid, PIDTYPE_PID);
> +	/*
> +	 * Send window will be closed after processing all NX requests
> +	 * and process exits after closing all windows. In multi-thread
> +	 * applications, thread may not exists, but does not close FD
> +	 * (means send window) upon exit. Parent thread (tgid) can use
> +	 * and close the window later.
> +	 */
> +	if (tsk) {
> +		if (tsk->flags & PF_EXITING)
> +			task_exit = 1;
> +		put_task_struct(tsk);
> +		pid = vas_window_pid(window);

The pid is later used for sending the signal again, why not keep the
reference?

> +	} else {
> +		pid = vas_window_tgid(window);
> +
> +		rcu_read_lock();
> +		tsk = find_task_by_vpid(pid);
> +		if (!tsk) {
> +			rcu_read_unlock();
> +			return;
> +		}
> +		if (tsk->flags & PF_EXITING)
> +			task_exit = 1;
> +		rcu_read_unlock();

Why does this not need a reference to the task, but the other one does?



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux