aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJerry Zuo <[email protected]>2017-05-24 11:01:32 -0400
committerAlex Deucher <[email protected]>2017-09-26 18:07:36 -0400
commitafdbd4ccfd36eb18ce89b504d79bb3051cdab839 (patch)
treeaa53498e46516130fe26606ab9098ff7c0d74f0a
parentece22899a46551dcd8e9f3296ce1ec8ac9e07dc4 (diff)
drm/amd/display: fix NULL pointer in dm_commit_surfaces
Check if adding surface is failed to prevent NULL pointer deref. Signed-off-by: Jerry Zuo <[email protected]> Reviewed-by: Harry Wentland <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
-rw-r--r--drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_types.c4
1 files changed, 4 insertions, 0 deletions
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 4da5a7154cea..810373480ed5 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
@@ -2411,6 +2411,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++;
}