[PATCH 10/19] drm/amd/display: fix NULL pointer in dm_commit_surfaces
Harry Wentland
harry.wentland at amd.com
Wed May 31 15:52:09 UTC 2017
From: Jerry Zuo <Jerry.Zuo at amd.com>
Check if adding surface is failed to prevent NULL pointer deref.
Change-Id: I804585bf126e74570875f4b8508358d3bad172a0
Signed-off-by: Jerry Zuo <Jerry.Zuo at amd.com>
Reviewed-by: Harry Wentland <Harry.Wentland at amd.com>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
index 15204bf7d9a8..543acb712edf 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c
@@ -2590,6 +2590,10 @@ static void amdgpu_dm_commit_surfaces(struct drm_atomic_state *state,
if (crtc == pcrtc) {
add_surface(dm->dc, crtc, plane,
&dc_surfaces_constructed[planes_count]);
+ if (dc_surfaces_constructed[planes_count] == NULL) {
+ dm_error("%s: Failed to add surface!\n", __func__);
+ continue;
+ }
dc_stream_attach = acrtc_attach->stream;
planes_count++;
}
--
2.11.0
More information about the amd-gfx
mailing list