Re: [PATCH rdma-next 2/2] RDMA/core: Check that process is still alive before sending it to the users

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

 



On Mon, Oct 07, 2019 at 06:58:13PM +0000, Parav Pandit wrote:
> > +	 * 2. Task is dead and in zombie state. There is no need to print PID
> > anymore.
> > +	 */
> > +	if (pid)
> > +		/*
> > +		 * This part is racy, task can be killed and PID will be zero right
> > +		 * here but it is ok, next query won't return PID. We don't
> > promise
> > +		 * real-time reflection of SW objects.
> > +		 */
> > +		err = nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_PID, pid);
> > +
> > +out:
> > +	return err ? -EMSGSIZE : 0;
> >  }
> 
> Below code reads better along with rest of the comments in the patch.
> 
> if (kern_resource) {
> 	err = nla_put_string(msg, RDMA_NLDEV_ATTR_RES_KERN_NAME,
> 			     res->kern_name);
> } else {
> 	pid_t pid;
> 
> 	pid = task_pid_vnr(res->task);
> 	if (pid)
> 		err = nla_put_u32(msg, RDMA_NLDEV_ATTR_RES_PID, pid);
> }

I tend to agree, that the pid == 0 happens for !kernel is pretty
indirect

Jason




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Photo]     [Yosemite News]     [Yosemite Photos]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux