Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp5038667pxb; Mon, 15 Feb 2021 08:00:39 -0800 (PST) X-Google-Smtp-Source: ABdhPJxHZYzaMmQPmkVxUigk1iA1JUiPtWCCQ65443gnQUZPlUGVtOsfNe0mFtJTkcHhgV6FC5/x X-Received: by 2002:a05:6402:7ce:: with SMTP id u14mr16369612edy.370.1613404839334; Mon, 15 Feb 2021 08:00:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1613404839; cv=none; d=google.com; s=arc-20160816; b=ZMzboKQXurv95BDepr9OmmeNLN+fvAwOoqmXRpZIOppWyi4RpAeJvVZ2dNi8HuIi66 hGZwYM56tIogAAVsgVNxS3ghdhGt2/p7iV/P8EbMAV0yjB8S73fBQi8jR1DgKGXnzj8g YzQOhVbNUB4YNGO+nyoKisedZCzP+G6JvXE17rRkgI0f+eoReqA/fC+3MPd56ojwsMFO vBdGXyyTyxshsz3wtl5VvhUZA1+vi226F/I3B+tMd7m1LLUc8Q55rEoGLfNpfZxvKGHq FhrHZPXN1Hyxf4TbpoZD2uMyD2nc+L1V++F8BlG6p8Kaf384fskZWVVNdk+VqOtJTLvY V7aA== 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=ZVrTLT3/+UllnyzR+YHBiadQ0e1xmT/zvUnI1qWutJI=; b=ptgAUQbBH+zE6IUv9uafi+Rsfl1kZR7nWYOtSWlwV0e7zRFzb5t1EcwkiZOKUXqAe3 SKT7Ul+qVlr+mOwMuP+m6PgbhTdF5xUADx9kFZsXdamSbPLN1ZVH7glRsSDaZYR6YuuO BpWgcnpgB86h5Eyj0bAwd83ptjXWzcyW+ianluGiXoOvEPAy5xpgLIZ/kp4Zi35AYN48 4/gYDqvQ1yUnYuGAAGYRodberqXoFoPA/SweQLk3sepfuDG9xrHmZX+NPUVqvuBNo4xc 70TalNsCIwjmMSIobJaHFGF4j6kbbaBlN3T6G2y9a69xEepkMb7OmPTvsxuM92cX7HZ+ Wpog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=HGRhxqOV; 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 jz7si12894334ejb.476.2021.02.15.08.00.14; Mon, 15 Feb 2021 08:00:39 -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=HGRhxqOV; 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 S232343AbhBOP6K (ORCPT + 99 others); Mon, 15 Feb 2021 10:58:10 -0500 Received: from mail.kernel.org ([198.145.29.99]:46652 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231264AbhBOPcf (ORCPT ); Mon, 15 Feb 2021 10:32:35 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id CE8AB64EA8; Mon, 15 Feb 2021 15:30:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1613403009; bh=U/xZuhGbzwadAV7+Puhex6iA6fGUFDhUDxhnIODlcAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HGRhxqOVPmvdAofxishl7H6P6VMc4lqlrd+RQ10oyU19qH/geJ6eUTjzEuKJkplyx YyZk1tZK/SX++bI8H6nrZhogyILoO1RJvKZG8tmXtmkjTuMvNNwDIc/0ghYgkJrLh8 6y+ph0rv8hXbtOnMVo27YLuB3zCvV/B5ED//S8hw= 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.4 18/60] drm/amd/display: Decrement refcount of dc_sink before reassignment Date: Mon, 15 Feb 2021 16:27:06 +0100 Message-Id: <20210215152715.955636732@linuxfoundation.org> X-Mailer: git-send-email 2.30.1 In-Reply-To: <20210215152715.401453874@linuxfoundation.org> References: <20210215152715.401453874@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 b4da8d1e4fb87..fbbe611d4873f 100644 --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -1417,8 +1417,10 @@ amdgpu_dm_update_connector_after_detect(struct amdgpu_dm_connector *aconnector) * 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