All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew Brost <matthew.brost@intel.com>
To: John Harrison <john.c.harrison@intel.com>
Cc: intel-gfx@lists.freedesktop.org, daniele.ceraolospurio@intel.com,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915: Check return intel_context_timeline_lock of in eb_pin_timeline
Date: Tue, 4 Jan 2022 15:06:35 -0800	[thread overview]
Message-ID: <20220104230635.GA15808@jons-linux-dev-box> (raw)
In-Reply-To: <cbfbab9f-8c1b-a07f-767a-be87b6646dbf@intel.com>

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@intel.com>
> > ---
> >   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);
> 

WARNING: multiple messages have this Message-ID (diff)
From: Matthew Brost <matthew.brost@intel.com>
To: John Harrison <john.c.harrison@intel.com>
Cc: intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org
Subject: Re: [Intel-gfx] [PATCH] drm/i915: Check return intel_context_timeline_lock of in eb_pin_timeline
Date: Tue, 4 Jan 2022 15:06:35 -0800	[thread overview]
Message-ID: <20220104230635.GA15808@jons-linux-dev-box> (raw)
In-Reply-To: <cbfbab9f-8c1b-a07f-767a-be87b6646dbf@intel.com>

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@intel.com>
> > ---
> >   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);
> 

  reply	other threads:[~2022-01-04 23:12 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-01-04 17:31 [PATCH] drm/i915: Check return intel_context_timeline_lock of in eb_pin_timeline Matthew Brost
2022-01-04 17:31 ` [Intel-gfx] " Matthew Brost
2022-01-04 18:31 ` [Intel-gfx] ✓ Fi.CI.BAT: success for " Patchwork
2022-01-04 20:17 ` [Intel-gfx] ✗ Fi.CI.IGT: failure " Patchwork
2022-01-04 23:05 ` [PATCH] " John Harrison
2022-01-04 23:05   ` [Intel-gfx] " John Harrison
2022-01-04 23:06   ` Matthew Brost [this message]
2022-01-04 23:06     ` Matthew Brost

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220104230635.GA15808@jons-linux-dev-box \
    --to=matthew.brost@intel.com \
    --cc=daniele.ceraolospurio@intel.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=john.c.harrison@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.