Commit 9519c865 authored by Ville Syrjälä's avatar Ville Syrjälä
Browse files

drm/i915: Fix locking in DRRS debugfs



Grab the crtc mutex so that looking at the crtc state is
actually safe.

Reviewed-by: default avatarJani Nikula <jani.nikula@intel.com>
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20221003113249.16213-5-ville.syrjala@linux.intel.com
parent adc831bf
Loading
Loading
Loading
Loading
+10 −2
Original line number Diff line number Diff line
@@ -301,8 +301,14 @@ void intel_crtc_drrs_init(struct intel_crtc *crtc)
static int intel_drrs_debugfs_status_show(struct seq_file *m, void *unused)
{
	struct intel_crtc *crtc = m->private;
	const struct intel_crtc_state *crtc_state =
		to_intel_crtc_state(crtc->base.state);
	const struct intel_crtc_state *crtc_state;
	int ret;

	ret = drm_modeset_lock_single_interruptible(&crtc->base.mutex);
	if (ret)
		return ret;

	crtc_state = to_intel_crtc_state(crtc->base.state);

	mutex_lock(&crtc->drrs.mutex);

@@ -321,6 +327,8 @@ static int intel_drrs_debugfs_status_show(struct seq_file *m, void *unused)

	mutex_unlock(&crtc->drrs.mutex);

	drm_modeset_unlock(&crtc->base.mutex);

	return 0;
}