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-next>] [day] [month] [year] [list]
Message-Id: <20220119123656.1456355-1-narmstrong@baylibre.com>
Date:   Wed, 19 Jan 2022 13:36:55 +0100
From:   Neil Armstrong <narmstrong@...libre.com>
To:     robert.foss@...aro.org
Cc:     Laurent.pinchart@...asonboard.com, jonas@...boo.se,
        jernej.skrabec@...il.com, dri-devel@...ts.freedesktop.org,
        linux-kernel@...r.kernel.org,
        Neil Armstrong <narmstrong@...libre.com>
Subject: [PATCH 1/2] drm/bridge: dw-hdmi: filter safe formats when first in bridge chain

If the dw-bridge is in the first position in the bridge chain, this
means there is no way to set the encoder output bus format.

In this case, this makes sure we only return the default format as return
of the get_input_bus_fmts() callback, limiting possible output formats
of dw-hdmi to what the dw-hdmi can convert from the default RGB24 input
format.

Fixes: 6c3c719936da ("drm/bridge: synopsys: dw-hdmi: add bus format negociation")
Signed-off-by: Neil Armstrong <narmstrong@...libre.com>
---
 drivers/gpu/drm/bridge/synopsys/dw-hdmi.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
index 97cdc61b57f6..56021f20d396 100644
--- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
+++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi.c
@@ -2674,6 +2674,25 @@ static u32 *dw_hdmi_bridge_atomic_get_input_bus_fmts(struct drm_bridge *bridge,
 	if (!input_fmts)
 		return NULL;
 
+	/* If dw-hdmi is the first bridge make sure it only takes RGB24 as input */
+	if (list_is_first(&bridge->chain_node, &bridge->encoder->bridge_chain)) {
+		switch (output_fmt) {
+		case MEDIA_BUS_FMT_FIXED:
+		case MEDIA_BUS_FMT_RGB888_1X24:
+		case MEDIA_BUS_FMT_YUV8_1X24:
+		case MEDIA_BUS_FMT_UYVY8_1X16:
+			input_fmts[i++] = MEDIA_BUS_FMT_RGB888_1X24;
+			break;
+		default:
+			kfree(input_fmts);
+			input_fmts = NULL;
+		}
+
+		*num_input_fmts = i;
+
+		return input_fmts;
+	}
+
 	switch (output_fmt) {
 	/* If MEDIA_BUS_FMT_FIXED is tested, return default bus format */
 	case MEDIA_BUS_FMT_FIXED:
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ