Commit 52024a94 authored by Alex Hung's avatar Alex Hung Committed by Alex Deucher
Browse files

drm/amd/display: Fix drm_edid leak in amdgpu_dm



[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: default avatarRoman Li <roman.li@amd.com>
Signed-off-by: default avatarAlex Hung <alex.hung@amd.com>
Signed-off-by: default avatarChuanyu Tseng <chuanyu.tseng@amd.com>
Signed-off-by: default avatarAlex Deucher <alexander.deucher@amd.com>
parent 6c006fac
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -3994,8 +3994,9 @@ void amdgpu_dm_update_connector_after_detect(

		aconnector->dc_sink = sink;
		dc_sink_retain(aconnector->dc_sink);
		if (sink->dc_edid.length == 0) {
		drm_edid_free(aconnector->drm_edid);
		aconnector->drm_edid = NULL;
		if (sink->dc_edid.length == 0) {
			hdmi_cec_unset_edid(aconnector);
			if (aconnector->dc_link->aux_mode) {
				drm_dp_cec_unset_edid(&aconnector->dm_dp_aux.aux);