From 5a032751b47347cf75ab95d116e9e4909dc93ef4 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Thu, 12 Dec 2024 12:04:25 +0100 Subject: [PATCH] 5.10-stable patches added patches: drm-amd-display-check-bios-images-before-it-is-used.patch --- ...-check-bios-images-before-it-is-used.patch | 82 +++++++++++++++++++ queue-5.10/series | 2 +- 2 files changed, 83 insertions(+), 1 deletion(-) create mode 100644 queue-5.10/drm-amd-display-check-bios-images-before-it-is-used.patch diff --git a/queue-5.10/drm-amd-display-check-bios-images-before-it-is-used.patch b/queue-5.10/drm-amd-display-check-bios-images-before-it-is-used.patch new file mode 100644 index 00000000000..2d764f379d7 --- /dev/null +++ b/queue-5.10/drm-amd-display-check-bios-images-before-it-is-used.patch @@ -0,0 +1,82 @@ +From 8b0ddf19cca2a352b2a7e01d99d3ba949a99c84c Mon Sep 17 00:00:00 2001 +From: Alex Hung +Date: Mon, 3 Jun 2024 08:24:13 -0600 +Subject: drm/amd/display: Check BIOS images before it is used + +From: Alex Hung + +commit 8b0ddf19cca2a352b2a7e01d99d3ba949a99c84c upstream. + +BIOS images may fail to load and null checks are added before they are +used. + +This fixes 6 NULL_RETURNS issues reported by Coverity. + +Reviewed-by: Harry Wentland +Acked-by: Hamza Mahfooz +Signed-off-by: Alex Hung +Signed-off-by: Alex Deucher +Signed-off-by: Keerthana K +Signed-off-by: Greg Kroah-Hartman +--- + drivers/gpu/drm/amd/display/dc/bios/bios_parser.c | 14 ++++++++++++++ + 1 file changed, 14 insertions(+) + +--- a/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c ++++ b/drivers/gpu/drm/amd/display/dc/bios/bios_parser.c +@@ -664,6 +664,9 @@ static enum bp_result get_ss_info_v3_1( + + ss_table_header_include = GET_IMAGE(ATOM_ASIC_INTERNAL_SS_INFO_V3, + DATA_TABLES(ASIC_InternalSS_Info)); ++ if (!ss_table_header_include) ++ return BP_RESULT_UNSUPPORTED; ++ + table_size = + (le16_to_cpu(ss_table_header_include->sHeader.usStructureSize) + - sizeof(ATOM_COMMON_TABLE_HEADER)) +@@ -1030,6 +1033,8 @@ static enum bp_result get_ss_info_from_i + + header = GET_IMAGE(ATOM_ASIC_INTERNAL_SS_INFO_V2, + DATA_TABLES(ASIC_InternalSS_Info)); ++ if (!header) ++ return result; + + memset(info, 0, sizeof(struct spread_spectrum_info)); + +@@ -1102,6 +1107,8 @@ static enum bp_result get_ss_info_from_s + get_atom_data_table_revision(header, &revision); + + tbl = GET_IMAGE(ATOM_SPREAD_SPECTRUM_INFO, DATA_TABLES(SS_Info)); ++ if (!tbl) ++ return result; + + if (1 != revision.major || 2 > revision.minor) + return result; +@@ -1634,6 +1641,8 @@ static uint32_t get_ss_entry_number_from + + tbl = GET_IMAGE(ATOM_SPREAD_SPECTRUM_INFO, + DATA_TABLES(SS_Info)); ++ if (!tbl) ++ return number; + + if (1 != revision.major || 2 > revision.minor) + return number; +@@ -1712,6 +1721,8 @@ static uint32_t get_ss_entry_number_from + + header_include = GET_IMAGE(ATOM_ASIC_INTERNAL_SS_INFO_V2, + DATA_TABLES(ASIC_InternalSS_Info)); ++ if (!header_include) ++ return 0; + + size = (le16_to_cpu(header_include->sHeader.usStructureSize) + - sizeof(ATOM_COMMON_TABLE_HEADER)) +@@ -1748,6 +1759,9 @@ static uint32_t get_ss_entry_number_from + + header_include = GET_IMAGE(ATOM_ASIC_INTERNAL_SS_INFO_V3, + DATA_TABLES(ASIC_InternalSS_Info)); ++ if (!header_include) ++ return number; ++ + size = (le16_to_cpu(header_include->sHeader.usStructureSize) - + sizeof(ATOM_COMMON_TABLE_HEADER)) / + sizeof(ATOM_ASIC_SS_ASSIGNMENT_V3); diff --git a/queue-5.10/series b/queue-5.10/series index 55ac1b884bb..d35732b91c7 100644 --- a/queue-5.10/series +++ b/queue-5.10/series @@ -383,7 +383,6 @@ kcsan-turn-report_filterlist_lock-into-a-raw_spinloc.patch timekeeping-always-check-for-negative-motion.patch media-uvcvideo-add-a-quirk-for-the-kaiweets-kti-w02-.patch media-cx231xx-add-support-for-dexatek-usb-video-grab.patch -hid-bpf-fix-nkro-on-mistel-md770.patch drm-vc4-hvs-set-axi-panic-modes-for-the-hvs.patch drm-panel-orientation-quirks-add-quirk-for-aya-neo-2.patch drm-mcde-enable-module-autoloading.patch @@ -448,3 +447,4 @@ kvm-arm64-vgic-its-clear-ite-when-discard-frees-an-ite.patch jffs2-prevent-rtime-decompress-memory-corruption.patch jffs2-fix-rtime-decompressor.patch xhci-dbc-fix-stall-transfer-event-handling.patch +drm-amd-display-check-bios-images-before-it-is-used.patch -- 2.47.3