lkml.org 
[lkml]   [2022]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] mm/damon/dbgfs: fix memory leak when using debugfs_lookup()
Date
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: SeongJae Park <sj@kernel.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: damon@lists.linux.dev
Cc: linux-mm@kvack.org
Cc: stable <stable@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
mm/damon/dbgfs.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/mm/damon/dbgfs.c b/mm/damon/dbgfs.c
index cb8a7e9926a4..dfb6ef8c83e0 100644
--- a/mm/damon/dbgfs.c
+++ b/mm/damon/dbgfs.c
@@ -915,6 +915,7 @@ static int dbgfs_rm_context(char *name)
new_ctxs[j++] = dbgfs_ctxs[i];
}

+ dput(dir);
kfree(dbgfs_dirs);
kfree(dbgfs_ctxs);

--
2.37.3
\
 
 \ /
  Last update: 2022-09-02 15:38    [W:0.040 / U:0.716 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site