blob: 7f3ec01660b95e73ead61081c1ba7736bf218260 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
|
From 48ae1c909b4c6e8a7d36f53d6f0900799dd108b0 Mon Sep 17 00:00:00 2001
From: jimqu <Jim.Qu@amd.com>
Date: Mon, 28 Nov 2016 08:05:46 +0800
Subject: [PATCH 0026/4131] drm/amd/display: Fix memory corruption issue.
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().
Signed-off-by: JimQu <Jim.Qu@amd.com>
Reviewed-by: Andrey Grodzovsky <Andrey.Grodzovsky@amd.com>
Acked-by: Harry Wentland <Harry.Wentland@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@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 f7638f8..424a7d4 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.7.4
|