From patchwork Tue Nov 3 20:37:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 316931 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 06BB3C2D0A3 for ; Tue, 3 Nov 2020 21:28:32 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id BB9DB20757 for ; Tue, 3 Nov 2020 21:28:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604438911; bh=VN2joP1QwjsTsFMr9W1EBaKAcBuzynY8faArlkwSbJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=HhS4PhrsJJGHtCNDTEHYUlU1G5+bYwq6HfjR/VEunuhpvoTLMYcjPllhJruDkgZHh sQG5tHolwXq/UmgLDEWUz9cpxUVnpbyUQssb+6TeUk7CfRTt9GtuETP5oCARzG9VLe 2ahcoFPeJ9bIUc6Qm4gYfRY5B58a/uQTD0jtMVyI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732587AbgKCU7r (ORCPT ); Tue, 3 Nov 2020 15:59:47 -0500 Received: from mail.kernel.org ([198.145.29.99]:35110 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733148AbgKCU7q (ORCPT ); Tue, 3 Nov 2020 15:59:46 -0500 Received: from localhost (83-86-74-64.cable.dynamic.v4.ziggo.nl [83.86.74.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 66BA522226; Tue, 3 Nov 2020 20:59:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1604437185; bh=VN2joP1QwjsTsFMr9W1EBaKAcBuzynY8faArlkwSbJo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=JjwC6anBCamWjrl/E+fc2gRkXVEkS/1M4fhZmerbQANbwAbqaXKNtDdLCUWF/eMvc cvYgx01/EZQxOceWH8ptNd2I6PMXvrJecAh381k4vV/olQw0Ih44K9vHH1CgTMejIM mbv+0CGr8fWN2UMA3oBNrkBqEfWCFBoVkCM1h9wU= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Nicholas Kazlauskas , Andrey Grodzovsky , Alex Deucher Subject: [PATCH 5.4 183/214] drm/amd/display: Avoid MST manager resource leak. Date: Tue, 3 Nov 2020 21:37:11 +0100 Message-Id: <20201103203307.859116601@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201103203249.448706377@linuxfoundation.org> References: <20201103203249.448706377@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Andrey Grodzovsky 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 Signed-off-by: Andrey Grodzovsky Acked-by: Alex Deucher Signed-off-by: Alex Deucher Cc: stable@vger.kernel.org Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -3956,6 +3956,13 @@ static void amdgpu_dm_connector_destroy( 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)