From a8972ccc5324e54243b632c77f3bcd07e24eb42a Mon Sep 17 00:00:00 2001 From: Sankeerth Billakanti Date: Mon, 24 Feb 2020 16:20:09 +0530 Subject: [PATCH] disp: msm: hdcp: avoid sink message processing when hdcp is off Skip processing the sink message in sde_hdcp_2x_main thread when hdcp TA is unloaded. If there is any error generated during the authentication sequence, then the hdcp authentication is aborted and the source will restart the authentication procedure. When authentication is aborted, the qseecom handle is lost and memory it referenced becomes protected. When a subsequent command execution in the sde_hdcp_2x_main thread tries to dereference that particular memory from the qseecom handle, there is a page fault crash observed. This change will skip accessing the memory referenced by the qseecom handle when hdcp authentication session is tearing down. Change-Id: I71ed44042897f17cc8817a1b1c54a43e42cf5f73 Signed-off-by: Sankeerth Billakanti --- msm/sde_hdcp_2x.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/msm/sde_hdcp_2x.c b/msm/sde_hdcp_2x.c index fa449ed98f..7734436557 100644 --- a/msm/sde_hdcp_2x.c +++ b/msm/sde_hdcp_2x.c @@ -480,6 +480,12 @@ static void sde_hdcp_2x_msg_sent(struct sde_hdcp_2x_ctrl *hdcp) SDE_EVT32_EXTERNAL(SDE_EVTLOG_FUNC_ENTRY, hdcp->authenticated, hdcp->app_data.response.data[0]); + + if (atomic_read(&hdcp->hdcp_off)) { + pr_debug("invalid state, hdcp off\n"); + goto exit; + } + switch (hdcp->app_data.response.data[0]) { case SKE_SEND_TYPE_ID: if (!hdcp2_app_comm(hdcp->hdcp2_ctx, @@ -531,6 +537,8 @@ static void sde_hdcp_2x_msg_sent(struct sde_hdcp_2x_ctrl *hdcp) } sde_hdcp_2x_wakeup_client(hdcp, &cdata); + +exit: SDE_EVT32_EXTERNAL(SDE_EVTLOG_FUNC_EXIT, hdcp->authenticated); }