dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/debugfs: fix dentry leak when removing files
@ 2026-06-09  5:36 raoxu
  2026-06-09  5:49 ` sashiko-bot
  0 siblings, 1 reply; 2+ messages in thread
From: raoxu @ 2026-06-09  5:36 UTC (permalink / raw)
  To: maarten.lankhorst
  Cc: mripard, tzimmermann, airlied, simona, dri-devel, linux-kernel,
	raoxu

From: Xu Rao <raoxu@uniontech.com>

debugfs_lookup() returns a referenced dentry. The caller must drop the
reference after it is done using the dentry.

drm_debugfs_remove_files() removes the looked-up file but never drops
the lookup reference. debugfs_remove() does not consume it.
debugfs_lookup_and_remove() exists for this case and does the dput().

Drop the dentry reference after removing the debugfs file.

Signed-off-by: Xu Rao <raoxu@uniontech.com>
---
 drivers/gpu/drm/drm_debugfs.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index ae1c6126c2c5..fbaa53ec2a4c 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -285,6 +285,7 @@ int drm_debugfs_remove_files(const struct drm_info_list *files, int count,

 		drmm_kfree(minor->dev, d_inode(dent)->i_private);
 		debugfs_remove(dent);
+		dput(dent);
 	}
 	return 0;
 }
--
2.50.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-06-09  7:16 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-09  5:36 [PATCH] drm/debugfs: fix dentry leak when removing files raoxu
2026-06-09  5:49 ` sashiko-bot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox