Commit 0b8bea8a authored by Alex Hung's avatar Alex Hung Committed by Heyuan Wang
Browse files

drm/amd/display: Validate function returns

mainline inclusion
from mainline-v6.11
commit 673f816b9e1e92d1f70e1bf5f21b531e0ff9ad6c
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/IARYEW
CVE: CVE-2024-46775

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=673f816b9e1e92d1f70e1bf5f21b531e0ff9ad6c



--------------------------------

[WHAT & HOW]
Function return values must be checked before data can be used
in subsequent functions.

This fixes 4 CHECKED_RETURN issues reported by Coverity.

Reviewed-by: default avatarHarry Wentland <harry.wentland@amd.com>
Signed-off-by: default avatarAlex Hung <alex.hung@amd.com>
Tested-by: default avatarDaniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Conflicts:
	drivers/gpu/drm/amd/display/dc/dc_dmub_srv.c
	drivers/gpu/drm/amd/display/dc/hubbub/dcn20/dcn20_hubbub.c
[Conflict due to not merge mainline commit 8b09656b22c0 and f9c7818c9d65]
Signed-off-by: default avatarYu Liao <liaoyu15@huawei.com>
parent 86591467
Loading
Loading
Loading
Loading
+5 −2
Original line number Diff line number Diff line
@@ -144,7 +144,9 @@ bool dc_dmub_srv_cmd_run_list(struct dc_dmub_srv *dc_dmub_srv, unsigned int coun
		if (status == DMUB_STATUS_QUEUE_FULL) {
			/* Execute and wait for queue to become empty again. */
			dmub_srv_cmd_execute(dmub);
			dmub_srv_wait_for_idle(dmub, 100000);
			status = dmub_srv_wait_for_idle(dmub, 100000);
			if (status != DMUB_STATUS_OK)
				return false;

			/* Requeue the command. */
			status = dmub_srv_cmd_queue(dmub, &cmd_list[i]);
@@ -407,7 +409,8 @@ void dc_dmub_srv_get_visual_confirm_color_cmd(struct dc *dc, struct pipe_ctx *pi
	union dmub_rb_cmd cmd = { 0 };
	unsigned int panel_inst = 0;

	dc_get_edp_link_panel_inst(dc, pipe_ctx->stream->link, &panel_inst);
	if (!dc_get_edp_link_panel_inst(dc, pipe_ctx->stream->link, &panel_inst))
		return;

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

+1 −2
Original line number Diff line number Diff line
@@ -1676,8 +1676,7 @@ bool perform_link_training_with_retries(
		if (status == LINK_TRAINING_ABORT) {
			enum dc_connection_type type = dc_connection_none;

			link_detect_connection_type(link, &type);
			if (type == dc_connection_none) {
			if (link_detect_connection_type(link, &type) && type == dc_connection_none) {
				DC_LOG_HW_LINK_TRAINING("%s: Aborting training because sink unplugged\n", __func__);
				break;
			}