Messages in this thread | | | Date | Fri, 2 Sep 2022 14:59:42 +0200 | From | Peter Zijlstra <> | Subject | Re: [PATCH 2/2] sched/debug: fix dentry leak in update_sched_domain_debugfs |
| |
On Fri, Sep 02, 2022 at 02:31:07PM +0200, Greg Kroah-Hartman wrote: > Kuyo reports that the pattern of using debugfs_remove(debugfs_lookup()) > leaks a dentry and with a hotplug stress test, the machine eventually > runs out of memory. > > Fix this up by using the newly created debugfs_lookup_and_remove() call > instead which properly handles the dentry reference counting logic.
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
> --- > kernel/sched/debug.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c > index bb3d63bdf4ae..667876da8382 100644 > --- a/kernel/sched/debug.c > +++ b/kernel/sched/debug.c > @@ -416,7 +416,7 @@ void update_sched_domain_debugfs(void) > char buf[32]; > > snprintf(buf, sizeof(buf), "cpu%d", cpu); > - debugfs_remove(debugfs_lookup(buf, sd_dentry)); > + debugfs_lookup_and_remove(buf, sd_dentry); > d_cpu = debugfs_create_dir(buf, sd_dentry); > > i = 0; > -- > 2.37.3 >
| |