* [PATCH] drm/i915: Check return intel_context_timeline_lock of in eb_pin_timeline
@ 2022-01-04 17:31 Matthew Brost
2022-01-04 23:05 ` John Harrison
0 siblings, 1 reply; 3+ messages in thread
From: Matthew Brost @ 2022-01-04 17:31 UTC (permalink / raw)
To: intel-gfx, dri-devel; +Cc: daniele.ceraolospurio, john.c.harrison
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);
intel_context_timeline_unlock(tl);
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/i915: Check return intel_context_timeline_lock of in eb_pin_timeline
2022-01-04 17:31 [PATCH] drm/i915: Check return intel_context_timeline_lock of in eb_pin_timeline Matthew Brost
@ 2022-01-04 23:05 ` John Harrison
2022-01-04 23:06 ` Matthew Brost
0 siblings, 1 reply; 3+ messages in thread
From: John Harrison @ 2022-01-04 23:05 UTC (permalink / raw)
To: Matthew Brost, intel-gfx, dri-devel; +Cc: daniele.ceraolospurio
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?
John.
> intel_context_timeline_unlock(tl);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/i915: Check return intel_context_timeline_lock of in eb_pin_timeline
2022-01-04 23:05 ` John Harrison
@ 2022-01-04 23:06 ` Matthew Brost
0 siblings, 0 replies; 3+ messages in thread
From: Matthew Brost @ 2022-01-04 23:06 UTC (permalink / raw)
To: John Harrison; +Cc: intel-gfx, daniele.ceraolospurio, dri-devel
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);
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-01-04 23:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-04 17:31 [PATCH] drm/i915: Check return intel_context_timeline_lock of in eb_pin_timeline Matthew Brost
2022-01-04 23:05 ` John Harrison
2022-01-04 23:06 ` Matthew Brost
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).