lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <YsvZcX4mZpP3a1L8@hirez.programming.kicks-ass.net>
Date:   Mon, 11 Jul 2022 10:04:01 +0200
From:   Peter Zijlstra <peterz@...radead.org>
To:     Major Chen <major.chen@...sung.com>
Cc:     "mingo@...hat.com" <mingo@...hat.com>,
        "juri.lelli@...hat.com" <juri.lelli@...hat.com>,
        "vincent.guittot@...aro.org" <vincent.guittot@...aro.org>,
        "dietmar.eggemann@....com" <dietmar.eggemann@....com>,
        "rostedt@...dmis.org" <rostedt@...dmis.org>,
        "bsegall@...gle.com" <bsegall@...gle.com>,
        "mgorman@...e.de" <mgorman@...e.de>,
        "bristot@...hat.com" <bristot@...hat.com>,
        Hongfei Tang <hongfei.tang@...sung.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] sched,debug: fix dentry leak in
 update_sched_domain_debugfs

On Mon, Jul 11, 2022 at 11:03:41AM +0800, Major Chen wrote:
>  
> update_sched_domain_debugfs() uses debugfs_lookup() to find wanted dentry(which has
> been created by debugfs_create_dir() before), but not call dput() to return this dentry
> back. This result in dentry leak even debugfs_remove() is called.
>  
> Signed-off-by: major.chen <major.chen@...sung.com>
> ---
>  kernel/sched/debug.c | 7 +++++--
>  1 file changed, 5 insertions(+), 2 deletions(-)
>  
> diff --git a/kernel/sched/debug.c b/kernel/sched/debug.c
> index bb3d63b..4ffea2d 100644
> --- a/kernel/sched/debug.c
> +++ b/kernel/sched/debug.c
> @@ -412,11 +412,14 @@ void update_sched_domain_debugfs(void)
>  
>          for_each_cpu(cpu, sd_sysctl_cpus) {
>                  struct sched_domain *sd;
> -                struct dentry *d_cpu;
> +                struct dentry *d_cpu, *d_lookup;
>                  char buf[32];
>  
>                  snprintf(buf, sizeof(buf), "cpu%d", cpu);
> -                debugfs_remove(debugfs_lookup(buf, sd_dentry));
> +                d_lookup = debugfs_lookup(buf, sd_dentry);
> +                debugfs_remove(d_lookup);
> +                if (!IS_ERR_OR_NULL(d_lookup))
> +                        dput(d_lookup);
>                  d_cpu = debugfs_create_dir(buf, sd_dentry);
>  
>                  i = 0;

Please try again, while not HTML, this email is severely whitespace
mangled (there's no '\t' characters in it for one).

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ