Skip to content

Commit

Permalink
drm/amd/display: Fix the uninitialized variable in enable_stream_feat…
Browse files Browse the repository at this point in the history
…ures()

commit 0726ed3 upstream.

In function enable_stream_features(), the variable "old_downspread.raw"
could be uninitialized if core_link_read_dpcd() fails, however, it is
used in the later if statement, and further, core_link_write_dpcd()
may write random value, which is potentially unsafe.

Fixes: 6016cd9 ("drm/amd/display: add helper for enabling mst stream features")
Cc: stable@vger.kernel.org
Signed-off-by: Yizhuo Zhai <yzhai003@ucr.edu>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Yizhuo Zhai authored and gregkh committed Jan 27, 2022
1 parent 2de6ce5 commit 3bf997e
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions drivers/gpu/drm/amd/display/dc/core/dc_link.c
Expand Up @@ -1696,6 +1696,8 @@ static void enable_stream_features(struct pipe_ctx *pipe_ctx)
union down_spread_ctrl old_downspread;
union down_spread_ctrl new_downspread;

memset(&old_downspread, 0, sizeof(old_downspread));

core_link_read_dpcd(link, DP_DOWNSPREAD_CTRL,
&old_downspread.raw, sizeof(old_downspread));

Expand Down

0 comments on commit 3bf997e

Please sign in to comment.