[PATCH 1/7] drm/amd/display: Fix memory corruption issue.
Harry Wentland
harry.wentland at amd.com
Fri Dec 2 15:12:28 UTC 2016
From: jimqu <Jim.Qu at amd.com>
temp_flip_context is always same as current_context,
and the current_context will be freed in
dc_commit_targets(), but temp_flip_context will be used in
dc_update_surfaces_for_target().
Change-Id: I86d1f311ce8c2d4989c2f212e4c65f721bcdc0fc
Signed-off-by: JimQu <Jim.Qu at amd.com>
Reviewed-by: Andrey Grodzovsky <Andrey.Grodzovsky at amd.com>
Acked-by: Harry Wentland <Harry.Wentland at amd.com>
---
drivers/gpu/drm/amd/display/dc/core/dc.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/display/dc/core/dc.c b/drivers/gpu/drm/amd/display/dc/core/dc.c
index f7638f84421b..424a7d4b8731 100644
--- a/drivers/gpu/drm/amd/display/dc/core/dc.c
+++ b/drivers/gpu/drm/amd/display/dc/core/dc.c
@@ -1096,8 +1096,12 @@ bool dc_commit_targets(
resource_validate_ctx_destruct(core_dc->current_context);
- dm_free(core_dc->current_context);
+ if (core_dc->temp_flip_context != core_dc->current_context) {
+ dm_free(core_dc->temp_flip_context);
+ core_dc->temp_flip_context = core_dc->current_context;
+ }
core_dc->current_context = context;
+ memset(core_dc->temp_flip_context, 0, sizeof(*core_dc->temp_flip_context));
return (result == DC_OK);
--
2.9.3
More information about the amd-gfx
mailing list