Skip to content

Commit 55f2bd9

Browse files
jnikulagregkh
authored andcommitted
drm/i915/hdcp: fix connector refcounting
commit 4cc2718 upstream. We acquire a connector reference before scheduling an HDCP prop work, and expect the work function to release the reference. However, if the work was already queued, it won't be queued multiple times, and the reference is not dropped. Release the reference immediately if the work was already queued. Fixes: a6597fa ("drm/i915: Protect workers against disappearing connectors") Cc: Sean Paul <[email protected]> Cc: Suraj Kandpal <[email protected]> Cc: Ville Syrjälä <[email protected]> Cc: [email protected] # v5.10+ Reviewed-by: Suraj Kandpal <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Jani Nikula <[email protected]> (cherry picked from commit abc0742) Signed-off-by: Joonas Lahtinen <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 937943c commit 55f2bd9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drivers/gpu/drm/i915/display/intel_hdcp.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1005,7 +1005,8 @@ static void intel_hdcp_update_value(struct intel_connector *connector,
10051005
hdcp->value = value;
10061006
if (update_property) {
10071007
drm_connector_get(&connector->base);
1008-
queue_work(i915->unordered_wq, &hdcp->prop_work);
1008+
if (!queue_work(i915->unordered_wq, &hdcp->prop_work))
1009+
drm_connector_put(&connector->base);
10091010
}
10101011
}
10111012

@@ -2480,7 +2481,8 @@ void intel_hdcp_update_pipe(struct intel_atomic_state *state,
24802481
mutex_lock(&hdcp->mutex);
24812482
hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
24822483
drm_connector_get(&connector->base);
2483-
queue_work(i915->unordered_wq, &hdcp->prop_work);
2484+
if (!queue_work(i915->unordered_wq, &hdcp->prop_work))
2485+
drm_connector_put(&connector->base);
24842486
mutex_unlock(&hdcp->mutex);
24852487
}
24862488

@@ -2497,7 +2499,9 @@ void intel_hdcp_update_pipe(struct intel_atomic_state *state,
24972499
*/
24982500
if (!desired_and_not_enabled && !content_protection_type_changed) {
24992501
drm_connector_get(&connector->base);
2500-
queue_work(i915->unordered_wq, &hdcp->prop_work);
2502+
if (!queue_work(i915->unordered_wq, &hdcp->prop_work))
2503+
drm_connector_put(&connector->base);
2504+
25012505
}
25022506
}
25032507

0 commit comments

Comments
 (0)