drm/amd/display: fix access hdcp_workqueue assert
authorHersen Wu <hersenxs.wu@amd.com>
Tue, 28 Mar 2023 14:45:24 +0000 (10:45 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 23 Aug 2023 15:52:27 +0000 (17:52 +0200)
[ Upstream commit cdff36a0217aadf5cbc167893ad1c0da869619cb ]

[Why] hdcp are enabled for asics from raven. for old asics
which hdcp are not enabled, hdcp_workqueue are null. some
access to hdcp work queue are not guarded with pointer check.

[How] add hdcp_workqueue pointer check before access workqueue.

Reviewed-by: Bhawanpreet Lakha <Bhawanpreet.Lakha@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_mst_types.c

index aa0ea28a86f02f116fbde8c91fb7b6990b5e2027..249b269e2cc537d98fa74526024229b218b92833 100644 (file)
@@ -8372,6 +8372,9 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
                struct amdgpu_crtc *acrtc = to_amdgpu_crtc(dm_new_con_state->base.crtc);
                struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
 
+               if (!adev->dm.hdcp_workqueue)
+                       continue;
+
                pr_debug("[HDCP_DM] -------------- i : %x ----------\n", i);
 
                if (!connector)
@@ -8420,6 +8423,9 @@ static void amdgpu_dm_atomic_commit_tail(struct drm_atomic_state *state)
                struct amdgpu_crtc *acrtc = to_amdgpu_crtc(dm_new_con_state->base.crtc);
                struct amdgpu_dm_connector *aconnector = to_amdgpu_dm_connector(connector);
 
+               if (!adev->dm.hdcp_workqueue)
+                       continue;
+
                new_crtc_state = NULL;
                old_crtc_state = NULL;
 
index 9884dd78c652c088ff6a381c4e0f1042893db881..a9ddff774a978117e13618026fc9cd311e6093f8 100644 (file)
@@ -379,13 +379,17 @@ static int dm_dp_mst_get_modes(struct drm_connector *connector)
                if (aconnector->dc_sink && connector->state) {
                        struct drm_device *dev = connector->dev;
                        struct amdgpu_device *adev = drm_to_adev(dev);
-                       struct hdcp_workqueue *hdcp_work = adev->dm.hdcp_workqueue;
-                       struct hdcp_workqueue *hdcp_w = &hdcp_work[aconnector->dc_link->link_index];
 
-                       connector->state->hdcp_content_type =
-                       hdcp_w->hdcp_content_type[connector->index];
-                       connector->state->content_protection =
-                       hdcp_w->content_protection[connector->index];
+                       if (adev->dm.hdcp_workqueue) {
+                               struct hdcp_workqueue *hdcp_work = adev->dm.hdcp_workqueue;
+                               struct hdcp_workqueue *hdcp_w =
+                                       &hdcp_work[aconnector->dc_link->link_index];
+
+                               connector->state->hdcp_content_type =
+                               hdcp_w->hdcp_content_type[connector->index];
+                               connector->state->content_protection =
+                               hdcp_w->content_protection[connector->index];
+                       }
                }
 #endif