Skip to content

Commit 06888d5

Browse files
keesalexdeucher
authored andcommitted
drm/amd/display: Avoid HDCP over-read and corruption
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 <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 66c4662 commit 06888d5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

drivers/gpu/drm/amd/display/modules/hdcp/hdcp1_execution.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,10 @@ static inline enum mod_hdcp_status validate_bksv(struct mod_hdcp *hdcp)
2929
{
3030
uint64_t n = 0;
3131
uint8_t count = 0;
32+
u8 bksv[sizeof(n)] = { };
3233

33-
memcpy(&n, hdcp->auth.msg.hdcp1.bksv, sizeof(uint64_t));
34+
memcpy(bksv, hdcp->auth.msg.hdcp1.bksv, sizeof(hdcp->auth.msg.hdcp1.bksv));
35+
n = *(uint64_t *)bksv;
3436

3537
while (n) {
3638
count++;

0 commit comments

Comments
 (0)