diff mbox series

[-next] mmc: debugfs: Fix file release memory leak

Message ID 20220608090152.179395-1-weiyongjun1@huawei.com (mailing list archive)
State New, archived
Headers show
Series [-next] mmc: debugfs: Fix file release memory leak | expand

Commit Message

Wei Yongjun June 8, 2022, 9:01 a.m. UTC
When using single_open() for opening, single_release() should be
used instead of seq_release(), otherwise there is a memory leak.

Fixes: c835a6debf06 ("mmc: debugfs: Add debug fs entry for mmc driver")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>
---
 drivers/mmc/core/debugfs.c | 1 +
 1 file changed, 1 insertion(+)

Comments

Adrian Hunter June 8, 2022, 2:28 p.m. UTC | #1
On 8/06/22 12:01, Wei Yongjun wrote:
> When using single_open() for opening, single_release() should be
> used instead of seq_release(), otherwise there is a memory leak.
> 
> Fixes: c835a6debf06 ("mmc: debugfs: Add debug fs entry for mmc driver")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Acked-by: Adrian Hunter <adrian.hunter@intel.com>

> ---
>  drivers/mmc/core/debugfs.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
> index 75e98ec88fb9..fe6808771bc7 100644
> --- a/drivers/mmc/core/debugfs.c
> +++ b/drivers/mmc/core/debugfs.c
> @@ -295,6 +295,7 @@ static const struct file_operations mmc_err_stats_fops = {
>  	.open	= mmc_err_stats_open,
>  	.read	= seq_read,
>  	.write	= mmc_err_stats_write,
> +	.release = single_release,
>  };
>  
>  void mmc_add_host_debugfs(struct mmc_host *host)
>
Ulf Hansson June 15, 2022, 5:32 p.m. UTC | #2
On Wed, 8 Jun 2022 at 01:43, Wei Yongjun <weiyongjun1@huawei.com> wrote:
>
> When using single_open() for opening, single_release() should be
> used instead of seq_release(), otherwise there is a memory leak.
>
> Fixes: c835a6debf06 ("mmc: debugfs: Add debug fs entry for mmc driver")
> Reported-by: Hulk Robot <hulkci@huawei.com>
> Signed-off-by: Wei Yongjun <weiyongjun1@huawei.com>

Applied for next, thanks!

Kind regards
Uffe


> ---
>  drivers/mmc/core/debugfs.c | 1 +
>  1 file changed, 1 insertion(+)
>
> diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
> index 75e98ec88fb9..fe6808771bc7 100644
> --- a/drivers/mmc/core/debugfs.c
> +++ b/drivers/mmc/core/debugfs.c
> @@ -295,6 +295,7 @@ static const struct file_operations mmc_err_stats_fops = {
>         .open   = mmc_err_stats_open,
>         .read   = seq_read,
>         .write  = mmc_err_stats_write,
> +       .release = single_release,
>  };
>
>  void mmc_add_host_debugfs(struct mmc_host *host)
>
diff mbox series

Patch

diff --git a/drivers/mmc/core/debugfs.c b/drivers/mmc/core/debugfs.c
index 75e98ec88fb9..fe6808771bc7 100644
--- a/drivers/mmc/core/debugfs.c
+++ b/drivers/mmc/core/debugfs.c
@@ -295,6 +295,7 @@  static const struct file_operations mmc_err_stats_fops = {
 	.open	= mmc_err_stats_open,
 	.read	= seq_read,
 	.write	= mmc_err_stats_write,
+	.release = single_release,
 };
 
 void mmc_add_host_debugfs(struct mmc_host *host)