From 5c2832439de7d0c6af5944bbf652f35255bb5599 Mon Sep 17 00:00:00 2001 From: jsg Date: Fri, 18 Oct 2024 00:08:23 +0000 Subject: [PATCH] drm/i915/hdcp: fix connector refcounting From Jani Nikula 55f2bd90b9fba95e929d4c407ffc422597152323 in linux-6.6.y/6.6.57 4cc2718f621a6a57a02581125bb6d914ce74d23b in mainline linux --- sys/dev/pci/drm/i915/display/intel_hdcp.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/dev/pci/drm/i915/display/intel_hdcp.c b/sys/dev/pci/drm/i915/display/intel_hdcp.c index 197c83f713e..a42e133bc21 100644 --- a/sys/dev/pci/drm/i915/display/intel_hdcp.c +++ b/sys/dev/pci/drm/i915/display/intel_hdcp.c @@ -1005,7 +1005,8 @@ static void intel_hdcp_update_value(struct intel_connector *connector, hdcp->value = value; if (update_property) { drm_connector_get(&connector->base); - queue_work(i915->unordered_wq, &hdcp->prop_work); + if (!queue_work(i915->unordered_wq, &hdcp->prop_work)) + drm_connector_put(&connector->base); } } @@ -2491,7 +2492,8 @@ void intel_hdcp_update_pipe(struct intel_atomic_state *state, mutex_lock(&hdcp->mutex); hdcp->value = DRM_MODE_CONTENT_PROTECTION_DESIRED; drm_connector_get(&connector->base); - queue_work(i915->unordered_wq, &hdcp->prop_work); + if (!queue_work(i915->unordered_wq, &hdcp->prop_work)) + drm_connector_put(&connector->base); mutex_unlock(&hdcp->mutex); } @@ -2508,7 +2510,9 @@ void intel_hdcp_update_pipe(struct intel_atomic_state *state, */ if (!desired_and_not_enabled && !content_protection_type_changed) { drm_connector_get(&connector->base); - queue_work(i915->unordered_wq, &hdcp->prop_work); + if (!queue_work(i915->unordered_wq, &hdcp->prop_work)) + drm_connector_put(&connector->base); + } } -- 2.20.1