drm/mst: Fix NULL pointer dereference at drm_dp_add_payload_part2
authorWayne Lin <Wayne.Lin@amd.com>
Thu, 7 Mar 2024 06:29:57 +0000 (14:29 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 21 May 2024 20:36:59 +0000 (16:36 -0400)
[Why]
Commit:
- commit 5aa1dfcdf0a4 ("drm/mst: Refactor the flow for payload allocation/removement")
accidently overwrite the commit
- commit 54d217406afe ("drm: use mgr->dev in drm_dbg_kms in drm_dp_add_payload_part2")
which cause regression.

[How]
Recover the original NULL fix and remove the unnecessary input parameter 'state' for
drm_dp_add_payload_part2().

Fixes: 5aa1dfcdf0a4 ("drm/mst: Refactor the flow for payload allocation/removement")
Reported-by: Leon Weiß <leon.weiss@ruhr-uni-bochum.de>
Link: https://lore.kernel.org/r/38c253ea42072cc825dc969ac4e6b9b600371cc8.camel@ruhr-uni-bochum.de/
Cc: lyude@redhat.com
Cc: imre.deak@intel.com
Cc: stable@vger.kernel.org
Cc: regressions@lists.linux.dev
Reviewed-by: Harry Wentland <harry.wentland@amd.com>
Acked-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Wayne Lin <Wayne.Lin@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240307062957.2323620-1-Wayne.Lin@amd.com
(cherry picked from commit 4545614c1d8da603e57b60dd66224d81b6ffc305)

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
drivers/gpu/drm/display/drm_dp_mst_topology.c
drivers/gpu/drm/i915/display/intel_dp_mst.c
drivers/gpu/drm/nouveau/dispnv50/disp.c
include/drm/display/drm_dp_mst_helper.h

index c27063305a1341c677c95e91dd49eb4fca1ea94a..2c36f3d00ca256f99186fe778eaf46a4e30739ee 100644 (file)
@@ -363,7 +363,7 @@ void dm_helpers_dp_mst_send_payload_allocation(
        mst_state = to_drm_dp_mst_topology_state(mst_mgr->base.state);
        new_payload = drm_atomic_get_mst_payload_state(mst_state, aconnector->mst_output_port);
 
-       ret = drm_dp_add_payload_part2(mst_mgr, mst_state->base.state, new_payload);
+       ret = drm_dp_add_payload_part2(mst_mgr, new_payload);
 
        if (ret) {
                amdgpu_dm_set_mst_status(&aconnector->mst_status,
index 3577786b5db2c4bdd48852b9957383cd011bdd92..7f8e1cfbe19d9f2065112e4fb9e74dce8a1ae74a 100644 (file)
@@ -3421,7 +3421,6 @@ EXPORT_SYMBOL(drm_dp_remove_payload_part2);
 /**
  * drm_dp_add_payload_part2() - Execute payload update part 2
  * @mgr: Manager to use.
- * @state: The global atomic state
  * @payload: The payload to update
  *
  * If @payload was successfully assigned a starting time slot by drm_dp_add_payload_part1(), this
@@ -3430,14 +3429,13 @@ EXPORT_SYMBOL(drm_dp_remove_payload_part2);
  * Returns: 0 on success, negative error code on failure.
  */
 int drm_dp_add_payload_part2(struct drm_dp_mst_topology_mgr *mgr,
-                            struct drm_atomic_state *state,
                             struct drm_dp_mst_atomic_payload *payload)
 {
        int ret = 0;
 
        /* Skip failed payloads */
        if (payload->payload_allocation_status != DRM_DP_MST_PAYLOAD_ALLOCATION_DFP) {
-               drm_dbg_kms(state->dev, "Part 1 of payload creation for %s failed, skipping part 2\n",
+               drm_dbg_kms(mgr->dev, "Part 1 of payload creation for %s failed, skipping part 2\n",
                            payload->port->connector->name);
                return -EIO;
        }
index c772ba19c5477aaab6ce7858d523d162c9d18b32..715d2f59f5652730102a5b4ee7d49e5ea1cad3b3 100644 (file)
@@ -1241,7 +1241,7 @@ static void intel_mst_enable_dp(struct intel_atomic_state *state,
        if (first_mst_stream)
                intel_ddi_wait_for_fec_status(encoder, pipe_config, true);
 
-       drm_dp_add_payload_part2(&intel_dp->mst_mgr, &state->base,
+       drm_dp_add_payload_part2(&intel_dp->mst_mgr,
                                 drm_atomic_get_mst_payload_state(mst_state, connector->port));
 
        if (DISPLAY_VER(dev_priv) >= 12)
index 0c3d88ad0b0eada56e28d0994dc6a3b0a3f04779..88728a0b2c259550ab6fc91c8e9754579d81a524 100644 (file)
@@ -915,7 +915,7 @@ nv50_msto_cleanup(struct drm_atomic_state *state,
                msto->disabled = false;
                drm_dp_remove_payload_part2(mgr, new_mst_state, old_payload, new_payload);
        } else if (msto->enabled) {
-               drm_dp_add_payload_part2(mgr, state, new_payload);
+               drm_dp_add_payload_part2(mgr, new_payload);
                msto->enabled = false;
        }
 }
index 3546b58a121bce861c54db5d7c57d5a83fed8530..cfe096389d94f7cc71d02662be0db8d12fdaf12a 100644 (file)
@@ -871,7 +871,6 @@ int drm_dp_add_payload_part1(struct drm_dp_mst_topology_mgr *mgr,
                             struct drm_dp_mst_topology_state *mst_state,
                             struct drm_dp_mst_atomic_payload *payload);
 int drm_dp_add_payload_part2(struct drm_dp_mst_topology_mgr *mgr,
-                            struct drm_atomic_state *state,
                             struct drm_dp_mst_atomic_payload *payload);
 void drm_dp_remove_payload_part1(struct drm_dp_mst_topology_mgr *mgr,
                                 struct drm_dp_mst_topology_state *mst_state,