drm/i915/region: don't leak the object on error
authorMatthew Auld <matthew.auld@intel.com>
Wed, 20 Jan 2021 10:47:14 +0000 (10:47 +0000)
committerChris Wilson <chris@chris-wilson.co.uk>
Wed, 20 Jan 2021 11:11:24 +0000 (11:11 +0000)
commit95b98f004f9d9ad240867ddbb7b3eb38a3471828
tree113871f50ad13abc68041749b6df4052426ad1e6
parent1e58215f06d6dae93e2c312d07ca433b7e5ce80d
drm/i915/region: don't leak the object on error

Sanity check the object size before allocating a new gem object.

Fixes: 97d553963250 ("drm/i915/region: convert object_create into object_init")
Testcase: igt/gem_create/create-massive
Signed-off-by: Matthew Auld <matthew.auld@intel.com>
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Link: https://patchwork.freedesktop.org/patch/msgid/20210120104714.112812-1-matthew.auld@intel.com
drivers/gpu/drm/i915/gem/i915_gem_region.c