diff options
author | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-09-09 08:52:27 +0000 |
---|---|---|
committer | Jonathan Gray <jsg@cvs.openbsd.org> | 2024-09-09 08:52:27 +0000 |
commit | f3fca1db40d45af80285d318f17ede0079f49242 (patch) | |
tree | 98ac195c121817e6c5f2771c26d759e2ef41e142 /sys/dev/pci | |
parent | 4572cac0e395988b510ca47e3b8920d7c710b7e7 (diff) |
drm/amd/display: Check msg_id before processing transcation
From Alex Hung
cb63090a17d3abb87f132851fa3711281249b7d2 in linux-6.6.y/6.6.50
fa71face755e27dc44bc296416ebdf2c67163316 in mainline linux
Diffstat (limited to 'sys/dev/pci')
-rw-r--r-- | sys/dev/pci/drm/amd/display/dc/hdcp/hdcp_msg.c | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/sys/dev/pci/drm/amd/display/dc/hdcp/hdcp_msg.c b/sys/dev/pci/drm/amd/display/dc/hdcp/hdcp_msg.c index f26325ac970..0440688a6e6 100644 --- a/sys/dev/pci/drm/amd/display/dc/hdcp/hdcp_msg.c +++ b/sys/dev/pci/drm/amd/display/dc/hdcp/hdcp_msg.c @@ -130,13 +130,21 @@ static bool hdmi_14_process_transaction( const uint8_t hdcp_i2c_addr_link_primary = 0x3a; /* 0x74 >> 1*/ const uint8_t hdcp_i2c_addr_link_secondary = 0x3b; /* 0x76 >> 1*/ struct i2c_command i2c_command; - uint8_t offset = hdcp_i2c_offsets[message_info->msg_id]; + uint8_t offset; struct i2c_payload i2c_payloads[] = { - { true, 0, 1, &offset }, + { true, 0, 1, 0 }, /* actual hdcp payload, will be filled later, zeroed for now*/ { 0 } }; + if (message_info->msg_id == HDCP_MESSAGE_ID_INVALID) { + DC_LOG_ERROR("%s: Invalid message_info msg_id - %d\n", __func__, message_info->msg_id); + return false; + } + + offset = hdcp_i2c_offsets[message_info->msg_id]; + i2c_payloads[0].data = &offset; + switch (message_info->link) { case HDCP_LINK_SECONDARY: i2c_payloads[0].address = hdcp_i2c_addr_link_secondary; @@ -310,6 +318,11 @@ static bool dp_11_process_transaction( struct dc_link *link, struct hdcp_protection_message *message_info) { + if (message_info->msg_id == HDCP_MESSAGE_ID_INVALID) { + DC_LOG_ERROR("%s: Invalid message_info msg_id - %d\n", __func__, message_info->msg_id); + return false; + } + return dpcd_access_helper( link, message_info->length, |