Re: [PATCH] drm/i915: Check return intel_context_timeline_lock of in eb_pin_timeline

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

 



On Tue, Jan 04, 2022 at 03:05:03PM -0800, John Harrison wrote:
> On 1/4/2022 09:31, Matthew Brost wrote:
> > intel_context_timeline_lock can return can error if interrupted by a
> > user when trying to lock the timeline mutex. Check the return value of
> > intel_context_timeline_lock in eb_pin_timeline (execbuf IOCTL).
> > 
> > Fixes: 544460c33821 ("drm/i915: Multi-BB execbuf")
> > Signed-off-by: Matthew Brost <matthew.brost@xxxxxxxxx>
> > ---
> >   drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c | 3 +++
> >   1 file changed, 3 insertions(+)
> > 
> > diff --git a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> > index e9541244027a..65a078945b00 100644
> > --- a/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> > +++ b/drivers/gpu/drm/i915/gem/i915_gem_execbuffer.c
> > @@ -2517,6 +2517,9 @@ static int eb_pin_timeline(struct i915_execbuffer *eb, struct intel_context *ce,
> >   			i915_request_put(rq);
> >   			tl = intel_context_timeline_lock(ce);
> > +			if (IS_ERR(tl))
> > +				return PTR_ERR(tl);
> > +
> >   			intel_context_exit(ce);
> Won't this leak the stuff acquired by the intel_context_enter() above if the
> _exit() is now skipped?
> 

Yep, this isn't right. I think should just call mutex_lock /
mutex_unlock directly on the timeline mutex.

Matt 

> John.
> 
> >   			intel_context_timeline_unlock(tl);
> 



[Index of Archives]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux