[PATCH 08/13] FIXUP: drm/i915: Protect workers against disappearing connectors
Sean Paul
sean at poorly.run
Fri Dec 13 20:25:23 UTC 2019
From: Sean Paul <seanpaul at chromium.org>
Changes in v3:
- Change the WARN_ON condition in intel_hdcp_cleanup to allow for
initializing connectors as well
Signed-off-by: Sean Paul <seanpaul at chromium.org>
---
drivers/gpu/drm/i915/display/intel_hdcp.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/gpu/drm/i915/display/intel_hdcp.c b/drivers/gpu/drm/i915/display/intel_hdcp.c
index c79dca2c74d1..fabacfb1b644 100644
--- a/drivers/gpu/drm/i915/display/intel_hdcp.c
+++ b/drivers/gpu/drm/i915/display/intel_hdcp.c
@@ -2088,11 +2088,15 @@ void intel_hdcp_cleanup(struct intel_connector *connector)
if (!hdcp->shim)
return;
- WARN_ON(!drm_connector_is_unregistered(&connector->base));
+ /*
+ * If the connector is registered, it's possible userspace could kick
+ * off another HDCP enable, which would re-spawn the workers.
+ */
+ WARN_ON(connector->base.registration_state == DRM_CONNECTOR_REGISTERED);
/*
- * Now that the connector is unregistered, check_work won't be run, but
- * cancel any outstanding instances of it
+ * Now that the connector is not registered, check_work won't be run,
+ * but cancel any outstanding instances of it
*/
cancel_delayed_work_sync(&hdcp->check_work);
@@ -2109,6 +2113,7 @@ void intel_hdcp_cleanup(struct intel_connector *connector)
mutex_lock(&hdcp->mutex);
kfree(hdcp->port_data.streams);
+ hdcp->shim = NULL;
mutex_unlock(&hdcp->mutex);
}
--
Sean Paul, Software Engineer, Google / Chromium OS
More information about the Intel-gfx-trybot
mailing list