lkml.org 
[lkml]   [2021]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH AUTOSEL 5.12 056/160] drm/amd/display: Avoid HDCP over-read and corruption
    Date
    From: Kees Cook <keescook@chromium.org>

    [ Upstream commit 06888d571b513cbfc0b41949948def6cb81021b2 ]

    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@chromium.org>
    Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
    Signed-off-by: Sasha Levin <sashal@kernel.org>
    ---
    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 73ca49f05bd3..eb56526ec32c 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.30.2
    \
     
     \ /
      Last update: 2021-07-06 13:40    [W:4.128 / U:0.016 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site