[PATCH] drm/debugfs: fix memory leak in drm_debugfs_remove_files()

Stanislaw Gruszka stanislaw.gruszka at linux.intel.com
Thu Dec 28 14:04:37 UTC 2023


On Thu, Dec 28, 2023 at 04:07:40PM +0800, Yaxiong Tian wrote:
> From: Yaxiong Tian <tianyaxiong at kylinos.cn>
> 
> The dentry returned by debugfs_lookup() needs to be released by calling
> dput() which is missing in drm_debugfs_remove_files(). Fix this by adding
> dput().
> 
> Signed-off-by: Yaxiong Tian <tianyaxiong at kylinos.cn>
Reviewed-by: Stanislaw Gruszka <stanislaw.gruszka at linux.intel.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 f4715a67e340..4d299152c302 100644
> --- a/drivers/gpu/drm/drm_debugfs.c
> +++ b/drivers/gpu/drm/drm_debugfs.c
> @@ -277,6 +277,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.25.1
> 


More information about the dri-devel mailing list