summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharlene Liu <Charlene.Liu@amd.com>2025-11-06 18:10:30 -0500
committerAlex Deucher <alexander.deucher@amd.com>2025-11-18 10:51:38 -0500
commit8ffa289f90be1a9b5bf693aa61004a9411ffe93a (patch)
treec30255e2916a65bfcf8ed5ca6be346e0d6da8639
parent79b3c037f972dcb13e325a8eabfb8da835764e15 (diff)
drm/amd/display: Add null pointer check in link_dpms
[why] Check that the stream exists to add link->local_sink null pointer access protection. Reviewed-by: Harold Sun <harold.sun@amd.com> Reviewed-by: Ethan Cheung <ethan.cheung@amd.com> Signed-off-by: Charlene Liu <Charlene.Liu@amd.com> Signed-off-by: Ivan Lipski <ivan.lipski@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
-rw-r--r--drivers/gpu/drm/amd/display/dc/link/link_dpms.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/gpu/drm/amd/display/dc/link/link_dpms.c b/drivers/gpu/drm/amd/display/dc/link/link_dpms.c
index 4ddcdc222913..2a70dcdd2e47 100644
--- a/drivers/gpu/drm/amd/display/dc/link/link_dpms.c
+++ b/drivers/gpu/drm/amd/display/dc/link/link_dpms.c
@@ -2226,7 +2226,11 @@ static enum dc_status enable_link(
{
enum dc_status status = DC_ERROR_UNEXPECTED;
struct dc_stream_state *stream = pipe_ctx->stream;
- struct dc_link *link = stream->link;
+ struct dc_link *link = NULL;
+
+ if (stream == NULL)
+ return DC_ERROR_UNEXPECTED;
+ link = stream->link;
/* There's some scenarios where driver is unloaded with display
* still enabled. When driver is reloaded, it may cause a display