Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 66a5ab10 authored by Lyude Paul's avatar Lyude Paul
Browse files

drm/i915: Fix possible race in intel_dp_add_mst_connector()



This hasn't caused any issues yet that I'm aware of, but as Ville
Syrjälä pointed out - we need to make sure that
intel_connector->mst_port is set before initializing MST connectors,
since in theory we could potentially check intel_connector->mst_port in
i915_hpd_poll_init_work() after registering the connector but before
having written it's value.

Signed-off-by: default avatarLyude Paul <lyude@redhat.com>
Reviewed-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Cc: Rodrigo Vivi <rodrigo.vivi@intel.com>
Cc: stable@vger.kernel.org
Link: https://patchwork.freedesktop.org/patch/msgid/20181106213017.14563-2-lyude@redhat.com
parent d0105af9
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -441,6 +441,10 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo
	if (!intel_connector)
	if (!intel_connector)
		return NULL;
		return NULL;


	intel_connector->get_hw_state = intel_dp_mst_get_hw_state;
	intel_connector->mst_port = intel_dp;
	intel_connector->port = port;

	connector = &intel_connector->base;
	connector = &intel_connector->base;
	ret = drm_connector_init(dev, connector, &intel_dp_mst_connector_funcs,
	ret = drm_connector_init(dev, connector, &intel_dp_mst_connector_funcs,
				 DRM_MODE_CONNECTOR_DisplayPort);
				 DRM_MODE_CONNECTOR_DisplayPort);
@@ -451,10 +455,6 @@ static struct drm_connector *intel_dp_add_mst_connector(struct drm_dp_mst_topolo


	drm_connector_helper_add(connector, &intel_dp_mst_connector_helper_funcs);
	drm_connector_helper_add(connector, &intel_dp_mst_connector_helper_funcs);


	intel_connector->get_hw_state = intel_dp_mst_get_hw_state;
	intel_connector->mst_port = intel_dp;
	intel_connector->port = port;

	for_each_pipe(dev_priv, pipe) {
	for_each_pipe(dev_priv, pipe) {
		struct drm_encoder *enc =
		struct drm_encoder *enc =
			&intel_dp->mst_encoders[pipe]->base.base;
			&intel_dp->mst_encoders[pipe]->base.base;