This is a note to let you know that I've just added the patch titled drm/amd/display: Fix late derefrence 'dsc' check in 'link_set_dsc_pps_packet()' to the 6.6-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: drm-amd-display-fix-late-derefrence-dsc-check-in-link_set_dsc_pps_packet.patch and it can be found in the queue-6.6 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let <stable@xxxxxxxxxxxxxxx> know about it. >From 3bb9b1f958c3d986ed90a3ff009f1e77e9553207 Mon Sep 17 00:00:00 2001 From: Srinivasan Shanmugam <srinivasan.shanmugam@xxxxxxx> Date: Wed, 10 Jan 2024 20:58:35 +0530 Subject: drm/amd/display: Fix late derefrence 'dsc' check in 'link_set_dsc_pps_packet()' From: Srinivasan Shanmugam <srinivasan.shanmugam@xxxxxxx> commit 3bb9b1f958c3d986ed90a3ff009f1e77e9553207 upstream. In link_set_dsc_pps_packet(), 'struct display_stream_compressor *dsc' was dereferenced in a DC_LOGGER_INIT(dsc->ctx->logger); before the 'dsc' NULL pointer check. Fixes the below: drivers/gpu/drm/amd/amdgpu/../display/dc/link/link_dpms.c:905 link_set_dsc_pps_packet() warn: variable dereferenced before check 'dsc' (see line 903) Cc: stable@xxxxxxxxxxxxxxx Cc: Aurabindo Pillai <aurabindo.pillai@xxxxxxx> Cc: Rodrigo Siqueira <Rodrigo.Siqueira@xxxxxxx> Cc: Hamza Mahfooz <hamza.mahfooz@xxxxxxx> Cc: Wenjing Liu <wenjing.liu@xxxxxxx> Cc: Qingqing Zhuo <qingqing.zhuo@xxxxxxx> Signed-off-by: Srinivasan Shanmugam <srinivasan.shanmugam@xxxxxxx> Reviewed-by: Aurabindo Pillai <aurabindo.pillai@xxxxxxx> Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/amd/display/dc/link/link_dpms.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/drivers/gpu/drm/amd/display/dc/link/link_dpms.c +++ b/drivers/gpu/drm/amd/display/dc/link/link_dpms.c @@ -873,11 +873,15 @@ bool link_set_dsc_pps_packet(struct pipe { struct display_stream_compressor *dsc = pipe_ctx->stream_res.dsc; struct dc_stream_state *stream = pipe_ctx->stream; - DC_LOGGER_INIT(dsc->ctx->logger); - if (!pipe_ctx->stream->timing.flags.DSC || !dsc) + if (!pipe_ctx->stream->timing.flags.DSC) + return false; + + if (!dsc) return false; + DC_LOGGER_INIT(dsc->ctx->logger); + if (enable) { struct dsc_config dsc_cfg; uint8_t dsc_packed_pps[128]; Patches currently in stable-queue which might be from srinivasan.shanmugam@xxxxxxx are queue-6.6/drm-amd-display-fix-late-derefrence-dsc-check-in-link_set_dsc_pps_packet.patch queue-6.6/drm-amd-display-fix-variable-deferencing-before-null-check-in-edp_setup_replay.patch queue-6.6/drm-amd-display-fix-uninitialized-variable-usage-in-core_link_-read_dpcd-write_dpcd-functions.patch