From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Hersen Wu <hersenxs.wu@amd.com>,
Qingqing Zhuo <Qingqing.Zhuo@amd.com>,
Qingqing Zhuo <qingqing.zhuo@amd.com>,
Daniel Wheeler <daniel.wheeler@amd.com>,
Alex Deucher <alexander.deucher@amd.com>,
Sasha Levin <sashal@kernel.org>,
harry.wentland@amd.com, sunpeng.li@amd.com,
Rodrigo.Siqueira@amd.com, christian.koenig@amd.com,
Xinhui.Pan@amd.com, airlied@gmail.com, daniel@ffwll.ch,
aurabindo.pillai@amd.com, hdegoede@redhat.com,
stylon.wang@amd.com, amd-gfx@lists.freedesktop.org,
dri-devel@lists.freedesktop.org
Subject: [PATCH AUTOSEL 6.3 05/11] drm/amd/display: fix memleak in aconnector->timing_requested
Date: Thu, 11 May 2023 15:37:48 -0400 [thread overview]
Message-ID: <20230511193757.623114-5-sashal@kernel.org> (raw)
In-Reply-To: <20230511193757.623114-1-sashal@kernel.org>
From: Hersen Wu <hersenxs.wu@amd.com>
[ Upstream commit 025ce392b5f213696ca0af3e07735d0fae020694 ]
[Why]
when amdgpu_dm_update_connector_after_detect is called
two times successively with valid sink, memory allocated of
aconnector->timing_requested for the first call is not free.
this causes memeleak.
[How]
allocate memory only when aconnector->timing_requested
is null.
Reviewed-by: Qingqing Zhuo <Qingqing.Zhuo@amd.com>
Acked-by: Qingqing Zhuo <qingqing.zhuo@amd.com>
Signed-off-by: Hersen Wu <hersenxs.wu@amd.com>
Tested-by: Daniel Wheeler <daniel.wheeler@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
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 a01fd41643fc2..5dced13f4ae8d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -3094,9 +3094,12 @@ void amdgpu_dm_update_connector_after_detect(
aconnector->edid);
}
- aconnector->timing_requested = kzalloc(sizeof(struct dc_crtc_timing), GFP_KERNEL);
- if (!aconnector->timing_requested)
- dm_error("%s: failed to create aconnector->requested_timing\n", __func__);
+ if (!aconnector->timing_requested) {
+ aconnector->timing_requested =
+ kzalloc(sizeof(struct dc_crtc_timing), GFP_KERNEL);
+ if (!aconnector->timing_requested)
+ dm_error("failed to create aconnector->requested_timing\n");
+ }
drm_connector_update_edid_property(connector, aconnector->edid);
amdgpu_dm_update_freesync_caps(connector, aconnector->edid);
--
2.39.2
next prev parent reply other threads:[~2023-05-11 19:38 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-05-11 19:37 [PATCH AUTOSEL 6.3 01/11] drm/amdgpu: release gpu full access after "amdgpu_device_ip_late_init" Sasha Levin
2023-05-11 19:37 ` [PATCH AUTOSEL 6.3 02/11] watchdog: menz069_wdt: fix watchdog initialisation Sasha Levin
2023-05-11 19:37 ` [PATCH AUTOSEL 6.3 03/11] ALSA: hda: Glenfly: add HD Audio PCI IDs and HDMI Codec Vendor IDs Sasha Levin
2023-05-11 19:37 ` [PATCH AUTOSEL 6.3 04/11] drm/amd/display: Do not set drr on pipe commit Sasha Levin
2023-05-11 19:37 ` Sasha Levin [this message]
2023-05-11 19:37 ` [PATCH AUTOSEL 6.3 06/11] of: fdt: Scan /memreserve/ last Sasha Levin
2023-05-15 20:21 ` Conor Dooley
2023-06-01 9:54 ` Sasha Levin
2023-05-11 19:37 ` [PATCH AUTOSEL 6.3 07/11] LoongArch: Relay BCE exceptions to userland as SIGSEGV with si_code=SEGV_BNDERR Sasha Levin
2023-05-11 19:37 ` [PATCH AUTOSEL 6.3 08/11] LoongArch: Add ARCH_HAS_FORTIFY_SOURCE selection Sasha Levin
2023-05-11 19:37 ` [PATCH AUTOSEL 6.3 09/11] netfilter: nf_tables: deactivate anonymous set from preparation phase Sasha Levin
2023-05-11 19:37 ` [PATCH AUTOSEL 6.3 10/11] ASoC: Intel: soc-acpi-cht: Add quirk for Nextbook Ares 8A tablet Sasha Levin
2023-05-11 19:37 ` [PATCH AUTOSEL 6.3 11/11] drm/amdgpu: Use the default reset when loading or reloading the driver Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230511193757.623114-5-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=Qingqing.Zhuo@amd.com \
--cc=Rodrigo.Siqueira@amd.com \
--cc=Xinhui.Pan@amd.com \
--cc=airlied@gmail.com \
--cc=alexander.deucher@amd.com \
--cc=amd-gfx@lists.freedesktop.org \
--cc=aurabindo.pillai@amd.com \
--cc=christian.koenig@amd.com \
--cc=daniel.wheeler@amd.com \
--cc=daniel@ffwll.ch \
--cc=dri-devel@lists.freedesktop.org \
--cc=harry.wentland@amd.com \
--cc=hdegoede@redhat.com \
--cc=hersenxs.wu@amd.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=stylon.wang@amd.com \
--cc=sunpeng.li@amd.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox