[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200203121620.9002-1-benjamin.gaignard@st.com>
Date: Mon, 3 Feb 2020 13:16:20 +0100
From: Benjamin Gaignard <benjamin.gaignard@...com>
To: <maarten.lankhorst@...ux.intel.com>, <mripard@...nel.org>,
<airlied@...ux.ie>, <daniel@...ll.ch>
CC: <dri-devel@...ts.freedesktop.org>, <linux-kernel@...r.kernel.org>,
Benjamin Gaignard <benjamin.gaignard@...com>,
<lyude@...hat.com>, <jani.nikula@...ux.intel.com>
Subject: [PATCH] drm/dp_mst: Check crc4 value while building sideband message
Check that computed crc value is matching the one encoded in the message.
Signed-off-by: Benjamin Gaignard <benjamin.gaignard@...com>
---
CC: lyude@...hat.com
CC: airlied@...ux.ie
CC: jani.nikula@...ux.intel.com
drivers/gpu/drm/drm_dp_mst_topology.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/drm_dp_mst_topology.c b/drivers/gpu/drm/drm_dp_mst_topology.c
index 822d2f177f90..eee899d6742b 100644
--- a/drivers/gpu/drm/drm_dp_mst_topology.c
+++ b/drivers/gpu/drm/drm_dp_mst_topology.c
@@ -736,6 +736,10 @@ static bool drm_dp_sideband_msg_build(struct drm_dp_sideband_msg_rx *msg,
if (msg->curchunk_idx >= msg->curchunk_len) {
/* do CRC */
crc4 = drm_dp_msg_data_crc4(msg->chunk, msg->curchunk_len - 1);
+ if (crc4 != msg->chunk[msg->curchunk_len - 1])
+ print_hex_dump(KERN_DEBUG, "wrong crc",
+ DUMP_PREFIX_NONE, 16, 1,
+ msg->chunk, msg->curchunk_len, false);
/* copy chunk into bigger msg */
memcpy(&msg->msg[msg->curlen], msg->chunk, msg->curchunk_len - 1);
msg->curlen += msg->curchunk_len - 1;
--
2.15.0
Powered by blists - more mailing lists