Skip to content

Commit b412c63

Browse files
committed
drm/i915/gt: Report context-is-closed prior to pinning
Our assertion caught that we do try to pin a closed context if userspace is viciously racing context-closure with execbuf, so make it fail gracefully. Closes: https://gitlab.freedesktop.org/drm/intel/issues/1492 Signed-off-by: Chris Wilson <[email protected]> Cc: Tvrtko Ursulin <[email protected]> Cc: Mika Kuoppala <[email protected]> Reviewed-by: Tvrtko Ursulin <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent cb1824b commit b412c63

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

drivers/gpu/drm/i915/gt/intel_context.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,8 +97,6 @@ int __intel_context_do_pin(struct intel_context *ce)
9797
{
9898
int err;
9999

100-
GEM_BUG_ON(intel_context_is_closed(ce));
101-
102100
if (unlikely(!test_bit(CONTEXT_ALLOC_BIT, &ce->flags))) {
103101
err = intel_context_alloc_state(ce);
104102
if (err)
@@ -114,6 +112,11 @@ int __intel_context_do_pin(struct intel_context *ce)
114112
goto out_release;
115113
}
116114

115+
if (unlikely(intel_context_is_closed(ce))) {
116+
err = -ENOENT;
117+
goto out_release;
118+
}
119+
117120
if (likely(!atomic_add_unless(&ce->pin_count, 1, 0))) {
118121
err = intel_context_active_acquire(ce);
119122
if (unlikely(err))

0 commit comments

Comments
 (0)