From: Eric Anholt Date: Wed, 10 Sep 2008 21:22:49 +0000 (-0700) Subject: drm: Avoid oops in GEM execbuffers with bad arguments. X-Git-Tag: v2.6.28-rc1~255^2~18 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=4f481ed22ec0d412336a13dc4477f6d0f3688882;p=linux-2.6-omap-h63xx.git drm: Avoid oops in GEM execbuffers with bad arguments. Signed-off-by: Eric Anholt Signed-off-by: Dave Airlie --- diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c index 5fe50343de1..29d9d21e941 100644 --- a/drivers/gpu/drm/i915/i915_gem.c +++ b/drivers/gpu/drm/i915/i915_gem.c @@ -1763,6 +1763,10 @@ i915_gem_execbuffer(struct drm_device *dev, void *data, (int) args->buffers_ptr, args->buffer_count, args->batch_len); #endif + if (args->buffer_count < 1) { + DRM_ERROR("execbuf with %d buffers\n", args->buffer_count); + return -EINVAL; + } /* Copy in the exec list from userland */ exec_list = drm_calloc(sizeof(*exec_list), args->buffer_count, DRM_MEM_DRIVER);