* [PATCH] drm/vc4: Fix memory leak during BO teardown
@ 2018-04-02 7:10 Daniel J Blueman
2018-04-05 1:34 ` Sasha Levin
2018-04-09 19:56 ` Eric Anholt
0 siblings, 2 replies; 3+ messages in thread
From: Daniel J Blueman @ 2018-04-02 7:10 UTC (permalink / raw)
To: linux-kernel
Cc: Daniel J Blueman, dri-devel, Eric Anholt, Dave Airlie, stable
During BO teardown, an indirect list 'uniform_addr_offsets' wasn't being
freed leading to leaking many 128B allocations. Fix the memory leak by
releasing it at teardown time.
To: linux-kernel@vger.kernel.org
Cc: dri-devel@lists.freedesktop.org
Cc: Eric Anholt <eric@anholt.net>
Cc: Dave Airlie <airlied@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Daniel J Blueman <daniel@quora.org>
---
drivers/gpu/drm/vc4/vc4_bo.c | 2 ++
drivers/gpu/drm/vc4/vc4_validate_shaders.c | 1 +
2 files changed, 3 insertions(+)
diff --git a/drivers/gpu/drm/vc4/vc4_bo.c b/drivers/gpu/drm/vc4/vc4_bo.c
index 2decc8e2c79f..add9cc97a3b6 100644
--- a/drivers/gpu/drm/vc4/vc4_bo.c
+++ b/drivers/gpu/drm/vc4/vc4_bo.c
@@ -195,6 +195,7 @@ static void vc4_bo_destroy(struct vc4_bo *bo)
vc4_bo_set_label(obj, -1);
if (bo->validated_shader) {
+ kfree(bo->validated_shader->uniform_addr_offsets);
kfree(bo->validated_shader->texture_samples);
kfree(bo->validated_shader);
bo->validated_shader = NULL;
@@ -591,6 +592,7 @@ void vc4_free_object(struct drm_gem_object *gem_bo)
}
if (bo->validated_shader) {
+ kfree(bo->validated_shader->uniform_addr_offsets);
kfree(bo->validated_shader->texture_samples);
kfree(bo->validated_shader);
bo->validated_shader = NULL;
diff --git a/drivers/gpu/drm/vc4/vc4_validate_shaders.c b/drivers/gpu/drm/vc4/vc4_validate_shaders.c
index d3f15bf60900..7cf82b071de2 100644
--- a/drivers/gpu/drm/vc4/vc4_validate_shaders.c
+++ b/drivers/gpu/drm/vc4/vc4_validate_shaders.c
@@ -942,6 +942,7 @@ vc4_validate_shader(struct drm_gem_cma_object *shader_obj)
fail:
kfree(validation_state.branch_targets);
if (validated_shader) {
+ kfree(validated_shader->uniform_addr_offsets);
kfree(validated_shader->texture_samples);
kfree(validated_shader);
}
--
2.11.0
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/vc4: Fix memory leak during BO teardown
2018-04-02 7:10 [PATCH] drm/vc4: Fix memory leak during BO teardown Daniel J Blueman
@ 2018-04-05 1:34 ` Sasha Levin
2018-04-09 19:56 ` Eric Anholt
1 sibling, 0 replies; 3+ messages in thread
From: Sasha Levin @ 2018-04-05 1:34 UTC (permalink / raw)
To: Sasha Levin, Daniel J Blueman, linux-kernel, linux-kernel
Cc: Daniel J Blueman, dri-devel, Eric Anholt, Dave Airlie, stable, stable
Hi Daniel J Blueman.
[This is an automated email]
This commit has been processed because it contains a -stable tag.
The stable tag indicates that it's relevant for the following trees: all
The bot has also determined it's probably a bug fixing patch. (score: 85.0720)
The bot has tested the following trees: v4.15.15, v4.14.32, v4.9.92, v4.4.126,
v4.15.15: Build OK!
v4.14.32: Build OK!
v4.9.92: Build OK!
v4.4.126: Failed to apply! Possible dependencies:
463873d57014: ("drm/vc4: Add an API for creating GPU shaders in GEM BOs.")
c826a6e10644: ("drm/vc4: Add a BO cache.")
d5bc60f6ad05: ("drm/vc4: Add create and map BO ioctls.")
c826a6e10644: ("drm/vc4: Add a BO cache.")
Please let us know if you'd like to have this patch included in a stable tree.
--
Thanks.
Sasha
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] drm/vc4: Fix memory leak during BO teardown
2018-04-02 7:10 [PATCH] drm/vc4: Fix memory leak during BO teardown Daniel J Blueman
2018-04-05 1:34 ` Sasha Levin
@ 2018-04-09 19:56 ` Eric Anholt
1 sibling, 0 replies; 3+ messages in thread
From: Eric Anholt @ 2018-04-09 19:56 UTC (permalink / raw)
To: Daniel J Blueman, linux-kernel
Cc: Daniel J Blueman, dri-devel, Dave Airlie, stable
[-- Attachment #1: Type: text/plain, Size: 295 bytes --]
Daniel J Blueman <daniel@quora.org> writes:
> During BO teardown, an indirect list 'uniform_addr_offsets' wasn't being
> freed leading to leaking many 128B allocations. Fix the memory leak by
> releasing it at teardown time.
Reviewed, added a Fixes tag, and pushed to drm-misc-fixes. Thanks!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-04-09 19:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-02 7:10 [PATCH] drm/vc4: Fix memory leak during BO teardown Daniel J Blueman
2018-04-05 1:34 ` Sasha Levin
2018-04-09 19:56 ` Eric Anholt
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®