[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CADnq5_PsvOqBW4-WDvR7BqaZgq3R8vYRPz2=c+87Dokk-zWz_A@mail.gmail.com>
Date: Tue, 1 Jun 2021 22:06:11 -0400
From: Alex Deucher <alexdeucher@...il.com>
To: Kees Cook <keescook@...omium.org>
Cc: Alex Deucher <alexander.deucher@....com>,
Martin Tsai <martin.tsai@....com>, Leo Li <sunpeng.li@....com>,
LKML <linux-kernel@...r.kernel.org>,
Wenjing Liu <wenjing.liu@....com>,
Anson Jacob <Anson.Jacob@....com>,
amd-gfx list <amd-gfx@...ts.freedesktop.org>,
Nicholas Kazlauskas <nicholas.kazlauskas@....com>,
David Airlie <airlied@...ux.ie>,
Daniel Wheeler <daniel.wheeler@....com>,
Maling list - DRI developers
<dri-devel@...ts.freedesktop.org>,
Christian König <christian.koenig@....com>,
Bindu Ramamurthy <bindu.r@....com>
Subject: Re: [PATCH] drm/amd/display: Avoid HDCP over-read and corruption
On Fri, May 28, 2021 at 1:54 PM Kees Cook <keescook@...omium.org> wrote:
>
> Instead of reading the desired 5 bytes of the actual target field,
> the code was reading 8. This could result in a corrupted value if the
> trailing 3 bytes were non-zero, so instead use an appropriately sized
> and zero-initialized bounce buffer, and read only 5 bytes before casting
> to u64.
>
> Signed-off-by: Kees Cook <keescook@...omium.org>
Applied. Thanks!
> ---
> drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
> index 2cbd931363bd..6d26d9c63ab2 100644
> --- a/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
> +++ b/drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c
> @@ -29,8 +29,10 @@ static inline enum mod_hdcp_status validate_bksv(struct mod_hdcp *hdcp)
> {
> uint64_t n = 0;
> uint8_t count = 0;
> + u8 bksv[sizeof(n)] = { };
>
> - memcpy(&n, hdcp->auth.msg.hdcp1.bksv, sizeof(uint64_t));
> + memcpy(bksv, hdcp->auth.msg.hdcp1.bksv, sizeof(hdcp->auth.msg.hdcp1.bksv));
> + n = *(uint64_t *)bksv;
>
> while (n) {
> count++;
> --
> 2.25.1
>
Powered by blists - more mailing lists