From: Xu Rao <[email protected]>

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 <[email protected]>
---
 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

Reply via email to