lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240126184639.8187-2-mario.limonciello@amd.com>
Date: Fri, 26 Jan 2024 12:46:38 -0600
From: Mario Limonciello <mario.limonciello@....com>
To: <amd-gfx@...ts.freedesktop.org>, Alex Deucher <alexander.deucher@....com>,
	Harry Wentland <harry.wentland@....com>, "Rafael J . Wysocki"
	<rafael@...nel.org>, Hans de Goede <hdegoede@...hat.com>
CC: "open list:ACPI" <linux-acpi@...r.kernel.org>, open list
	<linux-kernel@...r.kernel.org>, "open list:DRM DRIVERS"
	<dri-devel@...ts.freedesktop.org>, Melissa Wen <mwen@...lia.com>, "Mark
 Pearson" <mpearson-lenovo@...ebb.ca>, Mario Limonciello
	<mario.limonciello@....com>
Subject: [PATCH 1/2] ACPI: video: Handle fetching EDID that is longer than 256 bytes

The ACPI specification allows for an EDID to be up to 512 bytes but
the _DDC EDID fetching code will only try up to 256 bytes.

Modify the code to instead start at 512 bytes and work it's way
down instead.

Link: https://uefi.org/htmlspecs/ACPI_Spec_6_4_html/Apx_B_Video_Extensions/output-device-specific-methods.html#ddc-return-the-edid-for-this-device
Signed-off-by: Mario Limonciello <mario.limonciello@....com>
---
 drivers/acpi/acpi_video.c | 23 ++++++++++++++++-------
 1 file changed, 16 insertions(+), 7 deletions(-)

diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index 62f4364e4460..b3b15dd4755d 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -624,6 +624,10 @@ acpi_video_device_EDID(struct acpi_video_device *device,
 		arg0.integer.value = 1;
 	else if (length == 256)
 		arg0.integer.value = 2;
+	else if (length == 384)
+		arg0.integer.value = 3;
+	else if (length == 512)
+		arg0.integer.value = 4;
 	else
 		return -EINVAL;
 
@@ -1443,7 +1447,7 @@ int acpi_video_get_edid(struct acpi_device *device, int type, int device_id,
 
 	for (i = 0; i < video->attached_count; i++) {
 		video_device = video->attached_array[i].bind_info;
-		length = 256;
+		length = 512;
 
 		if (!video_device)
 			continue;
@@ -1478,13 +1482,18 @@ int acpi_video_get_edid(struct acpi_device *device, int type, int device_id,
 
 		if (ACPI_FAILURE(status) || !buffer ||
 		    buffer->type != ACPI_TYPE_BUFFER) {
-			length = 128;
-			status = acpi_video_device_EDID(video_device, &buffer,
-							length);
-			if (ACPI_FAILURE(status) || !buffer ||
-			    buffer->type != ACPI_TYPE_BUFFER) {
-				continue;
+			while (length) {
+				length -= 128;
+				status = acpi_video_device_EDID(video_device, &buffer,
+								length);
+				if (ACPI_FAILURE(status) || !buffer ||
+				    buffer->type != ACPI_TYPE_BUFFER) {
+					continue;
+				}
+				break;
 			}
+			if (!length)
+				continue;
 		}
 
 		*edid = buffer->buffer.pointer;
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ