Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp9095777pxu; Mon, 28 Dec 2020 06:32:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJzbXlAZjBZbge/G5dpA5vw9c7zTFn8jDlVlOy+pcaCy0beUj9Ft3GmLT/tJioHqHOY3irWt X-Received: by 2002:a17:906:39d5:: with SMTP id i21mr40409799eje.339.1609165926861; Mon, 28 Dec 2020 06:32:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609165926; cv=none; d=google.com; s=arc-20160816; b=NT4lyZI+RD+lEYpoeNzVDk2HvlMsSTVrPZ+csuJ8QNqCSMRZISIrGjERv0D2R8cWe5 A4LInN6AE0swjCmR6MX5kCwHZGSA1UxtgYxsMnpF2ZQEDFFmd5q7V47FUvVkY2kxjMIe Dyx6XwbR0ryl+bVALuYdhZEL8cLQI72GPirnAqMVXTYP1CNlXN0Im1VWAHntBXjCn0ZL 89tIcpnzXenV7Wjk8NYp+Yakr8uniRSWCOsPM8rg8uiS5BlFMTZiXTS5wqFpLxcdrW5S cQdCwVbXZoGzzHim/JE9bWp74ngKTgrGkv+SDdYDPhFRba8V6oFyAQ3Itg5TDbtUN/WQ uEFw== 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=KpXMdXslXr3qEb36wB/AJf4OvxTfXyupxOTFzKkaW6s=; b=lV+80IJvNVluiaxarmdvirymil17jVCt3qUA+mwDYdfQHHqVkdiFScDYedtatNSVF5 FYB0DwGF0NMWWtDI4yrnZb9bGe/COS+nJxmfgD+P+beq0KgHIsT80mbkJ2aLFulZCBoB jI/opYv2br/I1n59hW4L/HSZVuI7U8Wu0AvOrBHU1c3qasDtdeUjg2AR/X05sLZ2m7Sy 2lfAnnIxgVKrb/jpFva5lynEx9rfjtF3Up6U8ZbxAHVfWJnSwb/5SJHZlKSm9Qo+lZkQ lO7qOYRtu5kwfGFUp6eMqS3PXT/ZZ9QdojC7v1IRshKJypvn8pvQcAlVIA6oBg2jiFIA 8+dQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=EzjwRMqN; 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 w29si20381545edl.176.2020.12.28.06.31.43; Mon, 28 Dec 2020 06:32:06 -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=EzjwRMqN; 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 S2503560AbgL1O3X (ORCPT + 99 others); Mon, 28 Dec 2020 09:29:23 -0500 Received: from mail.kernel.org ([198.145.29.99]:36766 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2503454AbgL1O3O (ORCPT ); Mon, 28 Dec 2020 09:29:14 -0500 Received: by mail.kernel.org (Postfix) with ESMTPSA id 43B0C2242A; Mon, 28 Dec 2020 14:28:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1609165738; bh=f0MtBYQxwyMH24PPgtWnGMiKGObX0dd4D6wQQYlc8/Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EzjwRMqNRM1mD/sm80yTyXUaInwj8yNfX78Ei7/9THFM9iYDTs7Qm67Gg06bhAWYX RVzfn0cz/tIR+uRu3uH5X8uauL4AQUHB2eiqLLXFHobnuiSO0Wy7Q6ebBcZZRQKpMV iF/Li+m+ihimcTaUSRseAGgCEe06x+tuc1kRphjE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Harry Wentland , Alex Deucher , Nicholas Kazlauskas , Stylon Wang Subject: [PATCH 5.10 637/717] drm/amd/display: Fix memory leaks in S3 resume Date: Mon, 28 Dec 2020 13:50:35 +0100 Message-Id: <20201228125051.444911072@linuxfoundation.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201228125020.963311703@linuxfoundation.org> References: <20201228125020.963311703@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: Stylon Wang commit a135a1b4c4db1f3b8cbed9676a40ede39feb3362 upstream. EDID parsing in S3 resume pushes new display modes to probed_modes list but doesn't consolidate to actual mode list. This creates a race condition when amdgpu_dm_connector_ddc_get_modes() re-initializes the list head without walking the list and results in memory leak. Bug: https://bugzilla.kernel.org/show_bug.cgi?id=209987 Acked-by: Harry Wentland Acked-by: Alex Deucher Reviewed-by: Nicholas Kazlauskas Signed-off-by: Stylon Wang 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 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c +++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c @@ -2278,7 +2278,8 @@ void amdgpu_dm_update_connector_after_de drm_connector_update_edid_property(connector, aconnector->edid); - drm_add_edid_modes(connector, aconnector->edid); + aconnector->num_modes = drm_add_edid_modes(connector, aconnector->edid); + drm_connector_list_update(connector); if (aconnector->dc_link->aux_mode) drm_dp_cec_set_edid(&aconnector->dm_dp_aux.aux,