Re: [PATCH libdrm v2] etnaviv: prevent deadlock in error path

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

 



On Monday, 2017-08-21 13:12:07 +0000, Eric Engestrom wrote:
> On Monday, 2017-08-21 14:42:51 +0200, Philipp Zabel wrote:
> > If drmPrimeFDToHandle fails in etna_bo_from_dmabuf, the function must
> > not return with the table_lock mutex held. There is no reason to call
> > drmPrimeFDToHandle under that lock, so just take the lock after trying
> > to obtain the handle.

I was about to merge this, when I noticed the commit message doesn't
apply to v2 of this patch.
Can you re-spin it with this fixed, and I'll merge it for you?

Cheers,
  Eric

> > 
> > Based on ceb70a6b1015 ("freedreno: prevent deadlock in error path").
> > 
> > Signed-off-by: Philipp Zabel <p.zabel@xxxxxxxxxxxxxx>
> 
> Reviewed-by: Eric Engestrom <eric.engestrom@xxxxxxxxxx>
> 
> > ---
> > v2: keep lock around drmPrimeFDToHandle call
> > ---
> >  etnaviv/etnaviv_bo.c | 5 +++++
> >  1 file changed, 5 insertions(+)
> > 
> > diff --git a/etnaviv/etnaviv_bo.c b/etnaviv/etnaviv_bo.c
> > index 0cc3ab97..86fb894b 100644
> > --- a/etnaviv/etnaviv_bo.c
> > +++ b/etnaviv/etnaviv_bo.c
> > @@ -225,10 +225,15 @@ struct etna_bo *etna_bo_from_dmabuf(struct etna_device *dev, int fd)
> >  	int ret, size;
> >  	uint32_t handle;
> >  
> > +	/* take the lock before calling drmPrimeFDToHandle to avoid
> > +	 * racing against etna_bo_del, which might invalidate the
> > +	 * returned handle.
> > +	 */
> >  	pthread_mutex_lock(&table_lock);
> >  
> >  	ret = drmPrimeFDToHandle(dev->fd, fd, &handle);
> >  	if (ret) {
> > +		pthread_mutex_unlock(&table_lock);
> >  		return NULL;
> >  	}
> >  
> > -- 
> > 2.11.0
> > 
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux