drm/i915: Reject bind_to_gtt() early if object > aperture

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Tuesday, June 1, 2010 - 2:59 pm

Gitweb:     http://git.kernel.org/linus/654fc6073f68efa3b6c466825749e73e7fbb92cd
Commit:     654fc6073f68efa3b6c466825749e73e7fbb92cd
Parent:     85cd4612fdab4e837d7eea048a697c75d0477d3b
Author:     Chris Wilson <chris@chris-wilson.co.uk>
AuthorDate: Thu May 27 13:18:21 2010 +0100
Committer:  Eric Anholt <eric@anholt.net>
CommitDate: Fri May 28 10:52:15 2010 -0700

    drm/i915: Reject bind_to_gtt() early if object > aperture
    
    If the object is bigger than the entire aperture, reject it early
    before evicting everything in a vain attempt to find space.
    
    v2: Use E2BIG as suggested by Owain G. Ainsworth.
    
    Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
    Cc: stable@kernel.org
    Signed-off-by: Eric Anholt <eric@anholt.net>
---
 drivers/gpu/drm/i915/i915_gem.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index b87945d..f84c8e9 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -2648,6 +2648,14 @@ i915_gem_object_bind_to_gtt(struct drm_gem_object *obj, unsigned alignment)
 		return -EINVAL;
 	}
 
+	/* If the object is bigger than the entire aperture, reject it early
+	 * before evicting everything in a vain attempt to find space.
+	 */
+	if (obj->size > dev->gtt_total) {
+		DRM_ERROR("Attempting to bind an object larger than the aperture\n");
+		return -E2BIG;
+	}
+
  search_free:
 	free_space = drm_mm_search_free(&dev_priv->mm.gtt_space,
 					obj->size, alignment, 0);
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
drm/i915: Reject bind_to_gtt() early if object > aperture, Linux Kernel Mailing ..., (Tue Jun 1, 2:59 pm)