Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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 <akpm@linux-foundation.org>
Reviewed-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lore.kernel.org/r/20230202151633.2310897-1-gregkh@linuxfoundation.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

+1 -4
+1 -4
kernel/fail_function.c
··· 163 163 164 164 static void fei_debugfs_remove_attr(struct fei_attr *attr) 165 165 { 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); 170 167 } 171 168 172 169 static int fei_kprobe_handler(struct kprobe *kp, struct pt_regs *regs)