[PATCH] drm/amd/display: fix memory leak when using debugfs_lookup()

Greg Kroah-Hartman gregkh at linuxfoundation.org
Fri Sep 2 13:01:05 UTC 2022


When calling debugfs_lookup() the result must have dput() called on it,
otherwise the memory will leak over time.  Fix this up by properly
calling dput().

Cc: Harry Wentland <harry.wentland at amd.com>
Cc: Leo Li <sunpeng.li at amd.com>
Cc: Rodrigo Siqueira <Rodrigo.Siqueira at amd.com>
Cc: Alex Deucher <alexander.deucher at amd.com>
Cc: "Christian König" <christian.koenig at amd.com>
Cc: "Pan, Xinhui" <Xinhui.Pan at amd.com>
Cc: David Airlie <airlied at linux.ie>
Cc: Daniel Vetter <daniel at ffwll.ch>
Cc: Wayne Lin <Wayne.Lin at amd.com>
Cc: hersen wu <hersenxs.wu at amd.com>
Cc: Wenjing Liu <wenjing.liu at amd.com>
Cc: Patrik Jakobsson <patrik.r.jakobsson at gmail.com>
Cc: Thelford Williams <tdwilliamsiv at gmail.com>
Cc: Fangzhi Zuo <Jerry.Zuo at amd.com>
Cc: Yongzhi Liu <lyz_cs at pku.edu.cn>
Cc: Mikita Lipski <mikita.lipski at amd.com>
Cc: Jiapeng Chong <jiapeng.chong at linux.alibaba.com>
Cc: Bhanuprakash Modem <bhanuprakash.modem at intel.com>
Cc: Sean Paul <seanpaul at chromium.org>
Cc: amd-gfx at lists.freedesktop.org
Cc: dri-devel at lists.freedesktop.org
Signed-off-by: Greg Kroah-Hartman <gregkh at linuxfoundation.org>
---
 drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
index 0e48824f55e3..ee242d9d8b06 100644
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_debugfs.c
@@ -3288,6 +3288,7 @@ void crtc_debugfs_init(struct drm_crtc *crtc)
 				   &crc_win_y_end_fops);
 	debugfs_create_file_unsafe("crc_win_update", 0644, dir, crtc,
 				   &crc_win_update_fops);
+	dput(dir);
 #endif
 	debugfs_create_file("amdgpu_current_bpc", 0644, crtc->debugfs_entry,
 			    crtc, &amdgpu_current_bpc_fops);
-- 
2.37.3



More information about the amd-gfx mailing list