Skip to content

Commit 2bb3669

Browse files
committed
kernel/fail_function: fix memory leak with using debugfs_lookup()
When calling debugfs_lookup() the result must have dput() called on it, otherwise the memory will leak over time. To make things simpler, just call debugfs_lookup_and_remove() instead which handles all of the logic at once. Cc: Andrew Morton <[email protected]> Reviewed-by: Yang Yingliang <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a0bc3f7 commit 2bb3669

File tree

1 file changed

+1
-4
lines changed

1 file changed

+1
-4
lines changed

kernel/fail_function.c

+1-4
Original file line numberDiff line numberDiff line change
@@ -163,10 +163,7 @@ static void fei_debugfs_add_attr(struct fei_attr *attr)
163163

164164
static void fei_debugfs_remove_attr(struct fei_attr *attr)
165165
{
166-
struct dentry *dir;
167-
168-
dir = debugfs_lookup(attr->kp.symbol_name, fei_debugfs_dir);
169-
debugfs_remove_recursive(dir);
166+
debugfs_lookup_and_remove(attr->kp.symbol_name, fei_debugfs_dir);
170167
}
171168

172169
static int fei_kprobe_handler(struct kprobe *kp, struct pt_regs *regs)

0 commit comments

Comments
 (0)