]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
drm/amd/display: Avoid MST manager resource leak.
authorAndrey Grodzovsky <andrey.grodzovsky@amd.com>
Wed, 14 Oct 2020 17:12:30 +0000 (13:12 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 5 Nov 2020 10:51:49 +0000 (11:51 +0100)
commit 5dff80bdce9e385af5716ed083f9e33e814484ab upstream.

On connector destruction call drm_dp_mst_topology_mgr_destroy
to release resources allocated in drm_dp_mst_topology_mgr_init.
Do it only if MST manager was initilized before otherwsie a crash
is seen on driver unload/device unplug.

Reviewed-by: Nicholas Kazlauskas <nicholas.kazlauskas@amd.com>
Signed-off-by: Andrey Grodzovsky <andrey.grodzovsky@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index 5474f7e4c75b1b183bace35abad1532b53a2341f..6beccd5a0941abcf649c81206ea74e13a6c3680d 100644 (file)
@@ -4882,6 +4882,13 @@ static void amdgpu_dm_connector_destroy(struct drm_connector *connector)
        struct amdgpu_device *adev = connector->dev->dev_private;
        struct amdgpu_display_manager *dm = &adev->dm;
 
+       /*
+        * Call only if mst_mgr was iniitalized before since it's not done
+        * for all connector types.
+        */
+       if (aconnector->mst_mgr.dev)
+               drm_dp_mst_topology_mgr_destroy(&aconnector->mst_mgr);
+
 #if defined(CONFIG_BACKLIGHT_CLASS_DEVICE) ||\
        defined(CONFIG_BACKLIGHT_CLASS_DEVICE_MODULE)