linux/drivers/gpu/drm/tegra
Jon Hunter 280dc0e145 drm/tegra: Fix crash caused by reference count imbalance
Commit d2307dea14 ("drm/atomic: use connector references (v3)") added
reference counting for DRM connectors and this caused a crash when
exercising system suspend on Tegra114 Dalmore.

The Tegra DSI driver implements a Tegra specific function,
tegra_dsi_connector_duplicate_state(), to duplicate the connector state
and destroys the state using the generic helper function,
drm_atomic_helper_connector_destroy_state(). Following commit
d2307dea14 ("drm/atomic: use connector references (v3)") there is
now an imbalance in the connector reference count because the Tegra
function to duplicate state does not take a reference when duplicating
the state information. However, the generic helper function to destroy
the state information assumes a reference has been taken and during
system suspend, when the connector state is destroyed, this leads to a
crash because we attempt to put the reference for an object that has
already been freed.

Fix this by calling __drm_atomic_helper_connector_duplicate_state() from
tegra_dsi_connector_duplicate_state() to ensure that we take a reference
on a connector if crtc is set. Note that this will also copy the
connector state a 2nd time, but this should be harmless.

By fixing tegra_dsi_connector_duplicate_state() to take a reference,
although a crash was no longer seen, it was then observed that after
each system suspend-resume cycle, the reference would be one greater
than before the suspend-resume cycle. Following commit d2307dea14
("drm/atomic: use connector references (v3)"), it was found that we
also need to put the reference when calling the function
tegra_dsi_connector_reset() before freeing the state. Fix this by
updating tegra_dsi_connector_reset() to call the function
__drm_atomic_helper_connector_destroy_state() in order to put the
reference for the connector.

Fixes: d2307dea14 ("drm/atomic: use connector references (v3)")

Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Acked-by: Thierry Reding <treding@nvidia.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Link: http://patchwork.freedesktop.org/patch/msgid/1463585856-16606-1-git-send-email-jonathanh@nvidia.com
2016-05-18 18:03:33 +02:00
..
dc.c drm: Drop plane argument from __drm_atomic_helper_plane_destroy_state 2016-05-17 08:56:55 +02:00
dc.h drm/tegra: sor: Add HDMI support 2015-08-13 13:49:37 +02:00
dpaux.c drm/tegra: sor: Operate on struct drm_dp_aux * 2015-12-14 10:50:37 +01:00
dpaux.h drm/tegra: dpaux: Configure pads as I2C by default 2015-08-13 13:47:47 +02:00
drm.c drm: Remove unused drm_device from drm_gem_object_lookup() 2016-05-17 08:47:30 +02:00
drm.h drm/tegra: Stop cancelling page flip events 2016-02-08 09:55:52 +01:00
dsi.c drm/tegra: Fix crash caused by reference count imbalance 2016-05-18 18:03:33 +02:00
dsi.h drm/tegra: dsi: Add Tegra210 support 2015-08-13 13:47:45 +02:00
fb.c drm: Remove unused drm_device from drm_gem_object_lookup() 2016-05-17 08:47:30 +02:00
gem.c drm: Remove unused drm_device from drm_gem_object_lookup() 2016-05-17 08:47:30 +02:00
gem.h drm/tegra: gem: Use more consistent data types 2014-11-13 16:18:32 +01:00
gr2d.c drm/tegra: add MODULE_DEVICE_TABLEs 2014-08-04 10:07:39 +02:00
gr2d.h drm/tegra: Use symbolic names for gr2d registers 2013-10-31 09:55:44 +01:00
gr3d.c ARM: SoC cleanups for 3.17 2014-08-08 11:00:26 -07:00
gr3d.h drm/tegra: Add 3D support 2013-10-31 09:55:45 +01:00
hdmi.c drm: Pass 'name' to drm_encoder_init() 2015-12-11 09:13:20 +01:00
hdmi.h drm/tegra: hdmi: Name register fields consistently 2015-04-02 18:49:23 +02:00
Kconfig drm/tegra: Remove local fbdev emulation Kconfig option 2015-11-24 11:41:50 +01:00
Makefile drm/tegra: Remove host1x drm_bus implementation 2014-06-05 23:14:46 +02:00
mipi-phy.c drm/tegra: dsi: Adjust D-PHY timing 2015-01-27 10:14:40 +01:00
mipi-phy.h drm/tegra: Relicense under GPL v2 2014-04-04 09:12:51 +02:00
output.c drm/tegra: output: Support low-active hotplug detect 2015-08-13 13:47:40 +02:00
rgb.c drm: Pass 'name' to drm_encoder_init() 2015-12-11 09:13:20 +01:00
sor.c drm/tegra: Changes for v4.5-rc1 2015-12-17 08:38:57 +10:00
sor.h drm/tegra: sor: Add HDMI support 2015-08-13 13:49:37 +02:00