diff options
author | Cong Liu <liucong2@kylinos.cn> | 2023-04-15 00:41:09 +0200 |
---|---|---|
committer | Andi Shyti <andi.shyti@linux.intel.com> | 2023-04-15 22:38:54 +0200 |
commit | 8bfbdadce85c4c51689da10f39c805a7106d4567 (patch) | |
tree | cec1bd47c0432e0acde5171500b67d0efcd51d51 | |
parent | drm/i915/gt: Avoid out-of-bounds access when loading HuC (diff) | |
download | linux-8bfbdadce85c4c51689da10f39c805a7106d4567.tar.xz linux-8bfbdadce85c4c51689da10f39c805a7106d4567.zip |
drm/i915: Fix memory leaks in i915 selftests
This patch fixes memory leaks on error escapes in function fake_get_pages
Fixes: c3bfba9a2225 ("drm/i915: Check for integer truncation on scatterlist creation")
Signed-off-by: Cong Liu <liucong2@kylinos.cn>
Reviewed-by: Andrzej Hajda <andrzej.hajda@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230414224109.1051922-1-andi.shyti@linux.intel.com
-rw-r--r-- | drivers/gpu/drm/i915/selftests/i915_gem_gtt.c | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c index 5361ce70d3f2..154801f1c468 100644 --- a/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c +++ b/drivers/gpu/drm/i915/selftests/i915_gem_gtt.c @@ -69,8 +69,10 @@ static int fake_get_pages(struct drm_i915_gem_object *obj) rem = round_up(obj->base.size, BIT(31)) >> 31; /* restricted by sg_alloc_table */ - if (overflows_type(rem, unsigned int)) + if (overflows_type(rem, unsigned int)) { + kfree(pages); return -E2BIG; + } if (sg_alloc_table(pages, rem, GFP)) { kfree(pages); |