Skip to content

Commit

Permalink
drm/i915; Only increment the user-pin-count after successfully pinnin…
Browse files Browse the repository at this point in the history
…g the bo

As along the error path we do not correct the user pin-count for the
failure, we may end up with userspace believing that it has a pinned
object at offset 0 (when interrupted by a signal for example).

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Chris Wilson authored and Daniel Vetter committed Jan 7, 2013
1 parent d1c3ed6 commit 93be878
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions drivers/gpu/drm/i915/i915_gem.c
Original file line number Diff line number Diff line change
Expand Up @@ -3522,14 +3522,15 @@ i915_gem_pin_ioctl(struct drm_device *dev, void *data,
goto out;
}

obj->user_pin_count++;
obj->pin_filp = file;
if (obj->user_pin_count == 1) {
if (obj->user_pin_count == 0) {
ret = i915_gem_object_pin(obj, args->alignment, true, false);
if (ret)
goto out;
}

obj->user_pin_count++;
obj->pin_filp = file;

/* XXX - flush the CPU caches for pinned objects
* as the X server doesn't manage domains yet
*/
Expand Down

0 comments on commit 93be878

Please sign in to comment.