Skip to contentSkip to conversation

drm/dp_mst: Check crc4 value while building sideband message

PATCH In review Benjamin Gaignard 3 participants 3 messages Feb 3, 2020 – Feb 28, 2020

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/dp_mst: Check crc4 value while building sideband message

Check that computed crc value is matching the one encoded in the message.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

 drivers/gpu/drm/drm_dp_mst_topology.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +4 -0
index 822d2f177f90..eee899d6742b 100644
@@ -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;
Signature · 1 line
2.15.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 29 lines · Benjamin Gaignard

Check that computed crc value is matching the one encoded in the message.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

 drivers/gpu/drm/drm_dp_mst_topology.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +4 -0
index 822d2f177f90..eee899d6742b 100644
@@ -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;

Signature · 2 lines
Cheers,
	Lyude Paul
#2 lore raw
Quoted 3 lines · Lyude Paul

Applied on drm-misc-next
Thanks,
Benjamin

Quoted 38 lines · Benjamin Gaignard
Quoted 26 lines

Check that computed crc value is matching the one encoded in the message.

---
CC: [email protected]
CC: [email protected]
CC: [email protected]

 drivers/gpu/drm/drm_dp_mst_topology.c | 4 ++++
 1 file changed, 4 insertions(+)
drivers/gpu/drm/drm_dp_mst_topology.c +4 -0
index 822d2f177f90..eee899d6742b 100644
@@ -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 */
Quoted 3 lines
              memcpy(&msg->msg[msg->curlen], msg->chunk, msg->curchunk_len -
1);
              msg->curlen += msg->curchunk_len - 1;

--
Cheers,
Lyude Paul

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel