2020-02-03 14:40:42

by Benjamin GAIGNARD

[permalink] [raw]
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 <[email protected]>
---
CC: [email protected]
CC: [email protected]
CC: [email protected]
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


2020-02-04 19:01:27

by Lyude Paul

[permalink] [raw]
Subject: Re: [PATCH] drm/dp_mst: Check crc4 value while building sideband message

Reviewed-by: Lyude Paul <[email protected]>

On Mon, 2020-02-03 at 13:16 +0100, Benjamin Gaignard wrote:
> Check that computed crc value is matching the one encoded in the message.
>
> Signed-off-by: Benjamin Gaignard <[email protected]>
> ---
> CC: [email protected]
> CC: [email protected]
> CC: [email protected]
> 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;
--
Cheers,
Lyude Paul

2020-02-28 12:17:07

by Benjamin Gaignard

[permalink] [raw]
Subject: Re: [PATCH] drm/dp_mst: Check crc4 value while building sideband message

Le mar. 4 févr. 2020 à 20:00, Lyude Paul <[email protected]> a écrit :
>
> Reviewed-by: Lyude Paul <[email protected]>
>

Applied on drm-misc-next
Thanks,
Benjamin

> On Mon, 2020-02-03 at 13:16 +0100, Benjamin Gaignard wrote:
> > Check that computed crc value is matching the one encoded in the message.
> >
> > Signed-off-by: Benjamin Gaignard <[email protected]>
> > ---
> > CC: [email protected]
> > CC: [email protected]
> > CC: [email protected]
> > 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;
> --
> Cheers,
> Lyude Paul
>
> _______________________________________________
> dri-devel mailing list
> [email protected]
> https://lists.freedesktop.org/mailman/listinfo/dri-devel