[Intel-gfx] [PATCH 1/3] drm/i915: fix reference counting in i915_gem_create
Daniel Vetter
daniel.vetter at ffwll.ch
Wed Jul 24 13:00:57 CEST 2013
This function is called without the dev->struct_mutex held, hence we
need to use the _unlocked unreference variants.
As soon as the object is registered userspace can sneak in here with a
gem_close ioctl call, so the object can (and with my new evil tests
actually does) get the final unreference in this place. The lack of
locking then results in hilarity and some good leakage.
Signed-off-by: Daniel Vetter <daniel.vetter at ffwll.ch>
---
drivers/gpu/drm/i915/i915_gem.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 49592d6..8e6ff52 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -227,7 +227,7 @@ i915_gem_create(struct drm_file *file,
}
/* drop reference from allocate - handle holds it now */
- drm_gem_object_unreference(&obj->base);
+ drm_gem_object_unreference_unlocked(&obj->base);
trace_i915_gem_object_create(obj);
*handle_p = handle;
--
1.8.1.4
More information about the Intel-gfx
mailing list