drm/i915: Fix dereferencing invalid connectors in is_crtc_connector_off()
In commit e3de42b684
Author: Imre Deak <imre.deak@intel.com>
Date: Fri May 3 19:44:07 2013 +0200
drm/i915: force full modeset if the connector is in DPMS OFF mode
a new function was added that walked over the set of connectors to see
if any of the currently associated CRTC was switched off. This function
walked an array of connectors, rather than the array of pointers to
connectors contained in the drm_mode_set - i.e. it was dereferencing far
past the end of the first connector. This only becomes an issue if we
attempt to use a clone mode (i.e. more than one connector per CRTC) such
that set->num_connectors > 1.
Reported-by: Timo Aaltonen <tjaalton@ubuntu.com>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=65927
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: Imre Deak <imre.deak@intel.com>
Cc: Egbert Eich <eich@suse.de>
Cc: Jesse Barnes <jbarnes@virtuousgeek.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: stable@vger.kernel.org
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
This commit is contained in:
parent
35c95375f6
commit
2e57f47d31
@ -8540,15 +8540,20 @@ static void intel_set_config_restore_state(struct drm_device *dev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
is_crtc_connector_off(struct drm_crtc *crtc, struct drm_connector *connectors,
|
is_crtc_connector_off(struct drm_mode_set *set)
|
||||||
int num_connectors)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; i < num_connectors; i++)
|
if (set->num_connectors == 0)
|
||||||
if (connectors[i].encoder &&
|
return false;
|
||||||
connectors[i].encoder->crtc == crtc &&
|
|
||||||
connectors[i].dpms != DRM_MODE_DPMS_ON)
|
if (WARN_ON(set->connectors == NULL))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
for (i = 0; i < set->num_connectors; i++)
|
||||||
|
if (set->connectors[i]->encoder &&
|
||||||
|
set->connectors[i]->encoder->crtc == set->crtc &&
|
||||||
|
set->connectors[i]->dpms != DRM_MODE_DPMS_ON)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -8561,9 +8566,7 @@ intel_set_config_compute_mode_changes(struct drm_mode_set *set,
|
|||||||
|
|
||||||
/* We should be able to check here if the fb has the same properties
|
/* We should be able to check here if the fb has the same properties
|
||||||
* and then just flip_or_move it */
|
* and then just flip_or_move it */
|
||||||
if (set->connectors != NULL &&
|
if (is_crtc_connector_off(set)) {
|
||||||
is_crtc_connector_off(set->crtc, *set->connectors,
|
|
||||||
set->num_connectors)) {
|
|
||||||
config->mode_changed = true;
|
config->mode_changed = true;
|
||||||
} else if (set->crtc->fb != set->fb) {
|
} else if (set->crtc->fb != set->fb) {
|
||||||
/* If we have no fb then treat it as a full mode set */
|
/* If we have no fb then treat it as a full mode set */
|
||||||
|
Loading…
Reference in New Issue
Block a user