Skip to content

Commit

Permalink
drm/mst: Fix NULL pointer dereference at drm_dp_add_payload_part2
Browse files Browse the repository at this point in the history
commit 5a507b7 upstream.

[Why]
Commit:
- commit 5aa1dfc ("drm/mst: Refactor the flow for payload allocation/removement")
accidently overwrite the commit
- commit 54d2174 ("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: 5aa1dfc ("drm/mst: Refactor the flow for payload allocation/removement")
Reported-by: Leon Weiß <[email protected]>
Link: https://lore.kernel.org/r/38c253ea42072cc825dc969ac4e6b9b600371cc8.camel@ruhr-uni-bochum.de/
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Reviewed-by: Harry Wentland <[email protected]>
Acked-by: Jani Nikula <[email protected]>
Signed-off-by: Wayne Lin <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
(cherry picked from commit 4545614c1d8da603e57b60dd66224d81b6ffc305)
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
Wayne Lin authored and gregkh committed Jun 21, 2024
1 parent 6cb5c18 commit 8e21de5
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 7 deletions.
2 changes: 1 addition & 1 deletion drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_helpers.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 1 addition & 3 deletions drivers/gpu/drm/display/drm_dp_mst_topology.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/i915/display/intel_dp_mst.c
Original file line number Diff line number Diff line change
Expand Up @@ -1160,7 +1160,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)
Expand Down
2 changes: 1 addition & 1 deletion drivers/gpu/drm/nouveau/dispnv50/disp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
1 change: 0 additions & 1 deletion include/drm/display/drm_dp_mst_helper.h
Original file line number Diff line number Diff line change
Expand Up @@ -851,7 +851,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,
Expand Down

0 comments on commit 8e21de5

Please sign in to comment.