diff options
author | Daniel J Blueman <daniel@quora.org> | 2018-04-02 03:10:35 -0400 |
---|---|---|
committer | Eric Anholt <eric@anholt.net> | 2018-04-09 15:42:08 -0400 |
commit | c0db1b677e1d584fab5d7ac76a32e1c0157542e0 (patch) | |
tree | 4c85b772694f32ef50ff55ac338a9f6020015658 | |
parent | 5a9f698feb11b198f17b2acebbfe0e2716a3beed (diff) |
drm/vc4: Fix memory leak during BO teardown
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.
Cc: stable@vger.kernel.org
Fixes: 6d45c81d229d ("drm/vc4: Add support for branching in shader validation.")
Signed-off-by: Daniel J Blueman <daniel@quora.org>
Signed-off-by: Eric Anholt <eric@anholt.net>
Reviewed-by: Eric Anholt <eric@anholt.net>
Link: https://patchwork.freedesktop.org/patch/msgid/20180402071035.25356-1-daniel@quora.org
-rw-r--r-- | drivers/gpu/drm/vc4/vc4_bo.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/vc4/vc4_validate_shaders.c | 1 |
2 files changed, 3 insertions, 0 deletions
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) | |||
195 | vc4_bo_set_label(obj, -1); | 195 | vc4_bo_set_label(obj, -1); |
196 | 196 | ||
197 | if (bo->validated_shader) { | 197 | if (bo->validated_shader) { |
198 | kfree(bo->validated_shader->uniform_addr_offsets); | ||
198 | kfree(bo->validated_shader->texture_samples); | 199 | kfree(bo->validated_shader->texture_samples); |
199 | kfree(bo->validated_shader); | 200 | kfree(bo->validated_shader); |
200 | bo->validated_shader = NULL; | 201 | bo->validated_shader = NULL; |
@@ -591,6 +592,7 @@ void vc4_free_object(struct drm_gem_object *gem_bo) | |||
591 | } | 592 | } |
592 | 593 | ||
593 | if (bo->validated_shader) { | 594 | if (bo->validated_shader) { |
595 | kfree(bo->validated_shader->uniform_addr_offsets); | ||
594 | kfree(bo->validated_shader->texture_samples); | 596 | kfree(bo->validated_shader->texture_samples); |
595 | kfree(bo->validated_shader); | 597 | kfree(bo->validated_shader); |
596 | bo->validated_shader = NULL; | 598 | 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) | |||
942 | fail: | 942 | fail: |
943 | kfree(validation_state.branch_targets); | 943 | kfree(validation_state.branch_targets); |
944 | if (validated_shader) { | 944 | if (validated_shader) { |
945 | kfree(validated_shader->uniform_addr_offsets); | ||
945 | kfree(validated_shader->texture_samples); | 946 | kfree(validated_shader->texture_samples); |
946 | kfree(validated_shader); | 947 | kfree(validated_shader); |
947 | } | 948 | } |