Skip to content

Commit 4cc2718

Browse files
jnikulajlahtine-intel
authored andcommitted
drm/i915/hdcp: fix connector refcounting
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]>
1 parent 8cf0b93 commit 4cc2718

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
@@ -1094,7 +1094,8 @@ static void intel_hdcp_update_value(struct intel_connector *connector,
10941094
hdcp->value = value;
10951095
if (update_property) {
10961096
drm_connector_get(&connector->base);
1097-
queue_work(i915->unordered_wq, &hdcp->prop_work);
1097+
if (!queue_work(i915->unordered_wq, &hdcp->prop_work))
1098+
drm_connector_put(&connector->base);
10981099
}
10991100
}
11001101

@@ -2524,7 +2525,8 @@ void intel_hdcp_update_pipe(struct intel_atomic_state *state,
25242525
mutex_lock(&hdcp->mutex);
25252526
hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED;
25262527
drm_connector_get(&connector->base);
2527-
queue_work(i915->unordered_wq, &hdcp->prop_work);
2528+
if (!queue_work(i915->unordered_wq, &hdcp->prop_work))
2529+
drm_connector_put(&connector->base);
25282530
mutex_unlock(&hdcp->mutex);
25292531
}
25302532

@@ -2541,7 +2543,9 @@ void intel_hdcp_update_pipe(struct intel_atomic_state *state,
25412543
*/
25422544
if (!desired_and_not_enabled && !content_protection_type_changed) {
25432545
drm_connector_get(&connector->base);
2544-
queue_work(i915->unordered_wq, &hdcp->prop_work);
2546+
if (!queue_work(i915->unordered_wq, &hdcp->prop_work))
2547+
drm_connector_put(&connector->base);
2548+
25452549
}
25462550
}
25472551

0 commit comments

Comments
 (0)