From: Alex Hung <alex.hung@xxxxxxx> commit 3718a619a8c0a53152e76bb6769b6c414e1e83f4 upstream. dcn32_enable_phantom_stream can return null, so returned value must be checked before used. This fixes 1 NULL_RETURNS issue reported by Coverity. Reviewed-by: Rodrigo Siqueira <rodrigo.siqueira@xxxxxxx> Signed-off-by: Jerry Zuo <jerry.zuo@xxxxxxx> Signed-off-by: Alex Hung <alex.hung@xxxxxxx> Tested-by: Daniel Wheeler <daniel.wheeler@xxxxxxx> Signed-off-by: Alex Deucher <alexander.deucher@xxxxxxx> Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx> [Xiangyu: BP to fix CVE: CVE-2024-49897, modified the source path] Signed-off-by: Xiangyu Chen <xiangyu.chen@xxxxxxxxxxxxx> Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> --- drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c | 3 +++ 1 file changed, 3 insertions(+) --- a/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c +++ b/drivers/gpu/drm/amd/display/dc/dcn32/dcn32_resource.c @@ -1796,6 +1796,9 @@ void dcn32_add_phantom_pipes(struct dc * // be a valid candidate for SubVP (i.e. has a plane, stream, doesn't // already have phantom pipe assigned, etc.) by previous checks. phantom_stream = dcn32_enable_phantom_stream(dc, context, pipes, pipe_cnt, index); + if (!phantom_stream) + return; + dcn32_enable_phantom_plane(dc, context, phantom_stream, index); for (i = 0; i < dc->res_pool->pipe_count; i++) { Patches currently in stable-queue which might be from alex.hung@xxxxxxx are queue-6.1/drm-amd-display-check-phantom_stream-before-it-is-used.patch queue-6.1/drm-amd-display-check-null-initialized-variables.patch queue-6.1/drm-amd-display-add-null-check-for-clk_mgr-in-dcn32_init_hw.patch queue-6.1/drm-amd-display-initialize-denominators-default-to-1.patch queue-6.1/drm-amd-display-add-null-check-for-function-pointer-in-dcn20_set_output_transfer_func.patch queue-6.1/drm-amd-display-add-null-check-for-clk_mgr-and-clk_mgr-funcs-in-dcn30_init_hw.patch queue-6.1/drm-amd-display-add-null-check-for-function-pointer-.patch