Re: [PATCH 4.19 03/79] RDMA/restrack: Release task struct which was hold by CM_ID object

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

 



On Sat, Sep 21, 2019 at 10:22:10PM +0200, Pavel Machek wrote:
> Hi!
> 
> > commit ed7a01fd3fd77f40b4ef2562b966a5decd8928d2 upstream.
> > 
> > Tracking CM_ID resource is performed in two stages: creation of cm_id
> > and connecting it to the cma_dev. It is needed because rdma-cm protocol
> > exports two separate user-visible calls rdma_create_id and
> > rdma_accept.
> ...
> 
> Mainline says this needs additional fix, fe9bc1644918aa1d, see below.
> 
> > --- a/drivers/infiniband/core/restrack.c
> > +++ b/drivers/infiniband/core/restrack.c
> > @@ -209,7 +209,7 @@ void rdma_restrack_del(struct rdma_restr
> >  	struct ib_device *dev;
> >  
> >  	if (!res->valid)
> > -		return;
> > +		goto out;
> >  
> >  	dev = res_to_dev(res);
> >  	if (!dev)
> #                 return;
> 
> This test does return, does it need to go through 'goto out', too? (I
> see it should not happen, but...)
> 
> > @@ -222,8 +222,10 @@ void rdma_restrack_del(struct rdma_restr
> >  	down_write(&dev->res.rwsem);
> >  	hash_del(&res->node);
> >  	res->valid = false;
> > +	up_write(&dev->res.rwsem);
> > +
> > +out:
> >  	if (res->task)
> >  		put_task_struct(res->task);
> > -	up_write(&dev->res.rwsem);
> >  }
> 
> Mainline says res->task = NULL is needed there, see fe9bc1644918aa1d.

Good catch, now queued up, thanks!

greg k-h



[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux