Skip to content

Commit 07b93a5

Browse files
superm1alexdeucher
authored andcommitted
drm/amd/display: Avoid a NULL pointer dereference
[WHY] Although unlikely drm_atomic_get_new_connector_state() or drm_atomic_get_old_connector_state() can return NULL. [HOW] Check returns before dereference. Cc: Mario Limonciello <mario.limonciello@amd.com> Cc: Alex Deucher <alexander.deucher@amd.com> Reviewed-by: Harry Wentland <harry.wentland@amd.com> Signed-off-by: Mario Limonciello <mario.limonciello@amd.com> Signed-off-by: Alex Hung <alex.hung@amd.com> Tested-by: Dan Wheeler <daniel.wheeler@amd.com> Signed-off-by: Alex Deucher <alexander.deucher@amd.com> (cherry picked from commit 1e5e8d6) Cc: stable@vger.kernel.org
1 parent 79e25cd commit 07b93a5

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7792,6 +7792,9 @@ amdgpu_dm_connector_atomic_check(struct drm_connector *conn,
77927792
struct amdgpu_dm_connector *aconn = to_amdgpu_dm_connector(conn);
77937793
int ret;
77947794

7795+
if (WARN_ON(unlikely(!old_con_state || !new_con_state)))
7796+
return -EINVAL;
7797+
77957798
trace_amdgpu_dm_connector_atomic_check(new_con_state);
77967799

77977800
if (conn->connector_type == DRM_MODE_CONNECTOR_DisplayPort) {

0 commit comments

Comments
 (0)