Skip to content

RDKEMW-15033: Move tenablehdcp to rdke GitHub#191

Open
santoshcomcast wants to merge 3 commits into
developfrom
topic/RDKEMW-15033-fix-tenablehdcp-crash
Open

RDKEMW-15033: Move tenablehdcp to rdke GitHub#191
santoshcomcast wants to merge 3 commits into
developfrom
topic/RDKEMW-15033-fix-tenablehdcp-crash

Conversation

@santoshcomcast
Copy link
Copy Markdown
Contributor

Reason for change: Move tenablehdcp to rdke GitHub Test Procedure: refer RDKEMW-15033
Risks: High
Signed-off-by:gsanto722 grandhi_santoshkumar@comcast.com

Reason for change: Move tenablehdcp to rdke GitHub
Test Procedure: refer RDKEMW-15033
Risks: High
Signed-off-by:gsanto722 <grandhi_santoshkumar@comcast.com>
Copilot AI review requested due to automatic review settings May 5, 2026 11:02
@santoshcomcast santoshcomcast requested a review from a team as a code owner May 5, 2026 11:02
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the dsmgr HDCP enable flow in dsMgr.c by changing how the MFR serialized-data request buffer is managed and by adding extra validation around the returned key length before HDCP is enabled. In the broader codebase, this sits on the HDMI/HDCP startup path that pulls keys from MFR and passes them into _dsEnableHDCP.

Changes:

  • Replace the stack-allocated IARM_Bus_MFRLib_GetSerializedData_Param_t with a heap allocation and explicit cleanup.
  • Add a new bufLen validation branch before copying the HDCP key buffer.
  • Keep the existing HDCP enable flow but gate it behind the updated MFR-read handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread dsmgr/dsMgr.c
Comment on lines +271 to +278
/* Validate bufLen before using it - guard against corrupt/unexpected MFR response */
if (param->bufLen == 0 || param->bufLen > MAX_SERIALIZED_BUF) {
INT_ERROR("Invalid bufLen from MFR: %d, expected 0 < bufLen <= %d\n", param->bufLen, MAX_SERIALIZED_BUF);
sleep(2);
continue;
}
hdcpParam.keySize = param->bufLen;
if (hdcpParam.keySize < 0 || hdcpParam.keySize > HDCP_KEY_MAX_SIZE) {
if (hdcpParam.keySize > HDCP_KEY_MAX_SIZE) {
Comment thread dsmgr/dsMgr.c
Comment on lines +231 to +235
IARM_Bus_MFRLib_GetSerializedData_Param_t *param =
(IARM_Bus_MFRLib_GetSerializedData_Param_t *)malloc(sizeof(*param));
if (!param) {
INT_ERROR("Failed to allocate IARM_Bus_MFRLib_GetSerializedData_Param_t\n");
return NULL;
Comment thread dsmgr/dsMgr.c
Comment on lines +231 to +235
IARM_Bus_MFRLib_GetSerializedData_Param_t *param =
(IARM_Bus_MFRLib_GetSerializedData_Param_t *)malloc(sizeof(*param));
if (!param) {
INT_ERROR("Failed to allocate IARM_Bus_MFRLib_GetSerializedData_Param_t\n");
return NULL;
Copilot AI review requested due to automatic review settings May 6, 2026 13:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 7 comments.

Comments suppressed due to low confidence (1)

dsmgr/dsMgr.c:240

  • If memset_s(&hdcpParam, ...) fails, the code logs an error but continues and later passes hdcpParam to memcpy_s/_dsEnableHDCP. That leaves hdcpParam potentially uninitialized. On memset_s failure, bail out (free param and return) or otherwise ensure hdcpParam is in a known-safe state before use.
	rc = memset_s(&hdcpParam, sizeof(hdcpParam), 0, sizeof(hdcpParam));
	if (rc != EOK) {
		INT_ERROR("Failed to reset HDCP Param: error code:%d\n", rc);
	}

Comment thread mfr/mfrMgr.c
{
if (data.buf == NULL || data.bufLen == 0) {
LOG("[mfrMgr] getSerializedData_ ERROR: mfrGetSerializedData returned empty data (buf=%p bufLen=%d)\n",
data.buf, data.bufLen);
Comment thread mfr/mfrMgr.c
Comment on lines +127 to +138
LOG("[mfrMgr] getSerializedData_ mfrGetSerializedData returned err=%d data.bufLen=%d data.buf=%p\n",
err, data.bufLen, data.buf);

if(mfrERR_NONE == err)
{
if (data.buf == NULL || data.bufLen == 0) {
LOG("[mfrMgr] getSerializedData_ ERROR: mfrGetSerializedData returned empty data (buf=%p bufLen=%d)\n",
data.buf, data.bufLen);
return IARM_RESULT_IPCCORE_FAIL;
}
if (data.bufLen > (int)sizeof(param->buffer)) {
LOG("[mfrMgr] getSerializedData_ ERROR: data.bufLen=%d exceeds param->buffer size=%zu\n",
Comment thread mfr/mfrMgr.c
data.buf, data.bufLen);
return IARM_RESULT_IPCCORE_FAIL;
}
if (data.bufLen > (int)sizeof(param->buffer)) {
Comment thread dsmgr/dsMgr.c
Comment on lines +271 to +276
/* Validate bufLen before using it - guard against corrupt/unexpected MFR response */
if (param->bufLen == 0 || param->bufLen > MAX_SERIALIZED_BUF) {
INT_ERROR("Invalid bufLen from MFR: %d, expected 0 < bufLen <= %d\n", param->bufLen, MAX_SERIALIZED_BUF);
sleep(2);
continue;
}
Comment thread conf/mfrmgr.service
Comment on lines +27 to +28
ExecStartPre=/bin/mkdir -p /tmp/persistent
ExecStartPre=/bin/sh -c 'echo "/tmp/persistent/%%e.%%s.core" > /proc/sys/kernel/core_pattern'
Comment thread dsmgr/dsMgr.c
Comment on lines +494 to +495
INT_INFO("calling _enableHDCPAsync()\n");
_enableHDCPAsync();
Comment thread mfr/mfrMgr.c
Comment on lines +108 to +111
if (!param) {
LOG("[mfrMgr] getSerializedData_ ERROR: NULL param\n");
return IARM_RESULT_IPCCORE_FAIL;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants