Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5071075pxb; Mon, 15 Feb 2021 08:45:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJyoKujiMNWtVs7SJ324+fuw5GHXvE2qKMymWaXcvWjseh4R9rAkNqToexsuzlVxVkUDg0JM X-Received: by 2002:a17:906:54b:: with SMTP id k11mr15494135eja.495.1613407511972; Mon, 15 Feb 2021 08:45:11 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613407511; cv=none; d=google.com; s=arc-20160816; b=bUx1rXY/Q6AXsQD0khCK9N4wRA/g8t6R5NE5FjewjFOBSwOAsz3AJT90zUO/7I/1dh bOnUMNjvNJCPBy5tCXkYB6KX1N+nEsJkbxqYB/X3htXwpPxXg/wXRVA2gb3uHnaxshg4 8ZWaNXt0Of+tjR2yDFupB9ww1aCe995RJLR9t1osc6GCyHqbQe3pGu+43G++zL39kA8I EZBX9ttMyShSdgs6s4+ne2Rh+MRFOTs65HGhlevzDyuCyrdHUMnlG5sZWt5tmONRXINK E+jiItvMTYOB0ig1LKtlPpitu9FsYAebXS4tbe0PxAG7dhe+Ahte1/Z1ucsQ+dnvDOFH CAIA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=yybVBLAJMpZRpqAvrOLdWNMvgxlGcxj2VwiyI7hGXRU=; b=TNxCygSukmxiTOTHHsA6hCusbiQB98Z2sbXlqbKqEEzT5NWrNnuB3W8M5rA/pW5KOE 362ctFI5wz53VzOWSbbJDtay6cMUmAzc38KqyLX8uJd8vMZQvHUh38Chngb01atZO8hf 892DfxNvdpVtOK2h6t8sBjEaKeVxparkWPSFC3/cckFDxPTh6yDsO4fvM+3xGaOBgJ+c +d8LLGQUV7FSvHzD2vTWNMJvPSKbWvaHCwfX4cnqsNHnCF7NMBPS8/TcNXnHy0/tBp/P 5bg0UtfzMOlZg9W60H2yLBNqxlCYWKoseo9F6xT/uA00AQ2TFM1njJBQ1paDYRvaojfm 4mow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VpVeLQOJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p10si4648413edx.456.2021.02.15.08.44.49; Mon, 15 Feb 2021 08:45:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=VpVeLQOJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232311AbhBOQng (ORCPT + 99 others); Mon, 15 Feb 2021 11:43:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:49602 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231621AbhBOPiG (ORCPT ); Mon, 15 Feb 2021 10:38:06 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 35D9564EEE; Mon, 15 Feb 2021 15:34:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613403244; bh=cxKqO7/u5wHEciAat0FsEJjw9iDvaNGyv4dBpPqcfIs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VpVeLQOJnyZ+Da7WJXhie9XnXmwMDsNcjW71JTDrmgpkt4i5Fh4qrSlErZ5pHn9H/ zS6dXurBk7wCm7FTbjh9VFBo/LwQ+wO7OtmYEcC2yIj8N+DVoOEUVyuxyAPcSKTAZt S4/6r82oANSNuaWck7qg1pWpdx1XmHfWTAoAlRtc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Victor Lu , Rodrigo Siqueira , Anson Jacob , Daniel Wheeler , Alex Deucher , Sasha Levin Subject: [PATCH 5.10 036/104] drm/amd/display: Decrement refcount of dc_sink before reassignment Date: Mon, 15 Feb 2021 16:26:49 +0100 Message-Id: <20210215152720.650614905@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210215152719.459796636@linuxfoundation.org> References: <20210215152719.459796636@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Victor Lu [ Upstream commit 8e92bb0fa75bca9a57e4aba2e36f67d8016a3053 ] [why] An old dc_sink state is causing a memory leak because it is missing a dc_sink_release before a new dc_sink is assigned back to aconnector->dc_sink. [how] Decrement the dc_sink refcount before reassigning it to a new dc_sink. Signed-off-by: Victor Lu Reviewed-by: Rodrigo Siqueira Acked-by: Anson Jacob Tested-by: Daniel Wheeler Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c index 321df20fcdb99..fdca76fc598c0 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -2261,8 +2261,10 @@ void amdgpu_dm_update_connector_after_detect( * TODO: check if we still need the S3 mode update workaround. * If yes, put it here. */ - if (aconnector->dc_sink) + if (aconnector->dc_sink) { amdgpu_dm_update_freesync_caps(connector, NULL); + dc_sink_release(aconnector->dc_sink); + } aconnector->dc_sink = sink; dc_sink_retain(aconnector->dc_sink); -- 2.27.0