Skip to content

Commit

Permalink
drm/amdkcl: check drm_dp_add_payload_part2 whether requires two argun…
Browse files Browse the repository at this point in the history
…ments

It's caused by v6.9-rc6-1554-g8a0a7b98d4b6
drm/mst: Fix NULL pointer dereference at drm_dp_add_payload_part2

Signed-off-by: Bob Zhou <[email protected]>
Reviewed-by: Hawking Zhang <[email protected]>
  • Loading branch information
Asher Song authored and Hawking Zhang committed Sep 14, 2024
1 parent f0f89bc commit 2f767b9
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 0 deletions.
3 changes: 3 additions & 0 deletions drivers/gpu/drm/amd/dkms/config/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,9 @@
/* struct drm_display_info has monitor_range member */
#define HAVE_DRM_DISPLAY_INFO_MONITOR_RANGE 1

/* drm_dp_add_payload_part2 has two arguments */
/* #undef HAVE_DRM_DP_ADD_PAYLOAD_PART2_TWO_ARGUMENTS */

/* drm_dp_atomic_find_time_slots() is available */
#define HAVE_DRM_DP_ATOMIC_FIND_TIME_SLOTS 1

Expand Down
20 changes: 20 additions & 0 deletions drivers/gpu/drm/amd/dkms/m4/drm-dp-mst-topology-state.m4
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,23 @@ AC_DEFUN([AC_AMDGPU_DRM_DP_MST_TOPOLOGY_STATE_PBN_DIV], [
])
])

dnl #
dnl # commit v6.9-rc6-1554-g8a0a7b98d4b6
dnl # drm/mst: Fix NULL pointer dereference at drm_dp_add_payload_part2
dnl #
dnl # commit v5.19-rc6-1771-g4d07b0bc4034
dnl # drm/display/dp_mst: Move all payload info into the atomic state
dnl #
AC_DEFUN([AC_AMDGPU_DRM_DP_ADD_PAYLOAD_PART2_TWO_ARGUMENTS], [
AC_KERNEL_DO_BACKGROUND([
AC_KERNEL_TRY_COMPILE([
#include <drm/display/drm_dp_mst_helper.h>
], [
int a = 0;
a = drm_dp_add_payload_part2(NULL, NULL);
], [
AC_DEFINE(HAVE_DRM_DP_ADD_PAYLOAD_PART2_TWO_ARGUMENTS, 1,
[drm_dp_add_payload_part2 has two arguments])
])
])
])
1 change: 1 addition & 0 deletions drivers/gpu/drm/amd/dkms/m4/kernel.m4
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ AC_DEFUN([AC_CONFIG_KERNEL], [
AC_AMDGPU_DRM_GEM_OBJECT_IS_SHARED_FOR_MEMORY_STATS
AC_AMDGPU_DRM_DEBUG_CATEGORY
AC_AMDGPU_SMCA_UMC_V2
AC_AMDGPU_DRM_DP_ADD_PAYLOAD_PART2_TWO_ARGUMENTS
AC_KERNEL_WAIT
AS_IF([test "$LINUX_OBJ" != "$LINUX"], [
Expand Down
11 changes: 11 additions & 0 deletions include/kcl/backport/kcl_drm_dp_mst_helper_backport.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,15 @@ _kcl_drm_dp_mst_topology_mgr_resume(struct drm_dp_mst_topology_mgr *mgr,
#define drm_dp_mst_topology_mgr_resume _kcl_drm_dp_mst_topology_mgr_resume
#endif

#ifdef HAVE_DRM_DP_ADD_PAYLOAD_PART2_TWO_ARGUMENTS
static inline int
_kcl_drm_dp_add_payload_part2(struct drm_dp_mst_topology_mgr *mgr,
struct drm_atomic_state *state,
struct drm_dp_mst_atomic_payload *payload)
{
return drm_dp_add_payload_part2(mgr, payload);
}
#define drm_dp_add_payload_part2 _kcl_drm_dp_add_payload_part2
#endif

#endif

0 comments on commit 2f767b9

Please sign in to comment.