[PATCH] drm/amdgpu: update connector num_modes

Lee Starnes lee at canned-death.us
Mon Nov 9 05:59:42 UTC 2020


In amdgpu_dm.c, amdgpu_dm_update_connector_after_detect calls
drm_add_edid_modes, but it doesn't update the struct
amdgpu_dm_connector's num_modes like other places that call
drm_add_edid_modes do, so drm_display_modes allocated by
drm_add_edid_modes will never get freed. This causes a memleak which was
reported as https://bugzilla.kernel.org/show_bug.cgi?id=209987. It's
severe enough that it caused my system to OOM and have to be rebooted
several times.

The commit that causes this was backported to 5.9 and 5.4.

Fixes: b24bdc37d03a ("drm/amd/display: Fix EDID parsing after resume from suspend")
Cc: stable at vger.kernel.org
Signed-off-by: Lee Starnes <lee at canned-death.us>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c | 2 +-
 1 file changed, 1 insertion(+), 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 e93e18c06..06fe24a9d 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c
@@ -2281,7 +2281,7 @@ void amdgpu_dm_update_connector_after_detect(
 
 			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);
 
 			if (aconnector->dc_link->aux_mode)
 				drm_dp_cec_set_edid(&aconnector->dm_dp_aux.aux,
-- 
2.29.2



More information about the amd-gfx mailing list