]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/amd/display: Fix drm_edid leak in amdgpu_dm
authorAlex Hung <alex.hung@amd.com>
Mon, 9 Mar 2026 17:16:08 +0000 (11:16 -0600)
committerAlex Deucher <alexander.deucher@amd.com>
Mon, 23 Mar 2026 18:48:32 +0000 (14:48 -0400)
[WHAT]
When a sink is connected, aconnector->drm_edid was overwritten without
freeing the previous allocation, causing a memory leak on resume.

[HOW]
Free the previous drm_edid before updating it.

Reviewed-by: Roman Li <roman.li@amd.com>
Signed-off-by: Alex Hung <alex.hung@amd.com>
Signed-off-by: Chuanyu Tseng <chuanyu.tseng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
(cherry picked from commit 52024a94e7111366141cfc5d888b2ef011f879e5)
Cc: stable@vger.kernel.org
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

index a9c398b1516b84683f21f96b6c816310e60b4f25..acc3d8dad4a38ec1429f77557c028ef27375cc79 100644 (file)
@@ -3909,8 +3909,9 @@ void amdgpu_dm_update_connector_after_detect(
 
                aconnector->dc_sink = sink;
                dc_sink_retain(aconnector->dc_sink);
+               drm_edid_free(aconnector->drm_edid);
+               aconnector->drm_edid = NULL;
                if (sink->dc_edid.length == 0) {
-                       aconnector->drm_edid = NULL;
                        hdmi_cec_unset_edid(aconnector);
                        if (aconnector->dc_link->aux_mode) {
                                drm_dp_cec_unset_edid(&aconnector->dm_dp_aux.aux);