aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorChris Wilson <chris@chris-wilson.co.uk>2009-09-15 18:23:18 -0400
committerJesse Barnes <jbarnes@virtuousgeek.org>2009-09-18 18:31:21 -0400
commitcd0b9fb400ba775737bdc3874c4cbee4047e66d8 (patch)
treef5816a8740c8bf4b01381f9fb67b58a1ebf0c82e /drivers
parentedb81956422c9926553bb97e3e56b849da0f4bb5 (diff)
drm/i915: Check that the relocation points to within the target
Eric noted a potential concern with the low bits not being strictly used as part of the absolute offset (instead part of the command stream to the GPU), but in practice that should not be an issue. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Tested-by: Andy Whitcroft <apw@canonical.com> Cc: Eric Anholt <eric@anholt.net> CC: stable@kernel.org Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/i915/i915_gem.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index 725b4484a092..c60ca32f65d2 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -3158,6 +3158,16 @@ i915_gem_object_pin_and_relocate(struct drm_gem_object *obj,
3158 return -EINVAL; 3158 return -EINVAL;
3159 } 3159 }
3160 3160
3161 if (reloc->delta >= target_obj->size) {
3162 DRM_ERROR("Relocation beyond target object bounds: "
3163 "obj %p target %d delta %d size %d.\n",
3164 obj, reloc->target_handle,
3165 (int) reloc->delta, (int) target_obj->size);
3166 drm_gem_object_unreference(target_obj);
3167 i915_gem_object_unpin(obj);
3168 return -EINVAL;
3169 }
3170
3161 if (reloc->write_domain & I915_GEM_DOMAIN_CPU || 3171 if (reloc->write_domain & I915_GEM_DOMAIN_CPU ||
3162 reloc->read_domains & I915_GEM_DOMAIN_CPU) { 3172 reloc->read_domains & I915_GEM_DOMAIN_CPU) {
3163 DRM_ERROR("reloc with read/write CPU domains: " 3173 DRM_ERROR("reloc with read/write CPU domains: "