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] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 25 Oct 2019 09:39:13 +0200
From:   Jiri Olsa <jolsa@...hat.com>
To:     Hewenliang <hewenliang4@...wei.com>
Cc:     peterz@...radead.org, acme@...nel.org, mark.rutland@....com,
        alexander.shishkin@...ux.intel.com, namhyung@...nel.org,
        ilubashe@...mai.com, ak@...ux.intel.com,
        linux-kernel@...r.kernel.org, hushiyuan@...wei.com,
        linfeilong@...wei.com
Subject: Re: [PATCH] perf tools: Call closedir to release the resource before
 we return

On Thu, Oct 24, 2019 at 11:16:05PM -0400, Hewenliang wrote:
> We should close the directory on pattern failure before the return
> of rm_rf_depth_pat.
> 
> Fixes: cdb6b0235f170 ("perf tools: Add pattern name checking to rm_rf")
> Signed-off-by: Hewenliang <hewenliang4@...wei.com>

Acked-by: Jiri Olsa <jolsa@...nel.org>

thanks,
jirka

> ---
>  tools/perf/util/util.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c
> index 5eda6e19c947..1aadca8c43f3 100644
> --- a/tools/perf/util/util.c
> +++ b/tools/perf/util/util.c
> @@ -154,8 +154,10 @@ static int rm_rf_depth_pat(const char *path, int depth, const char **pat)
>  		if (!strcmp(d->d_name, ".") || !strcmp(d->d_name, ".."))
>  			continue;
>  
> -		if (!match_pat(d->d_name, pat))
> +		if (!match_pat(d->d_name, pat)) {
> +			closedir(dir);
>  			return -2;
> +		}
>  
>  		scnprintf(namebuf, sizeof(namebuf), "%s/%s",
>  			  path, d->d_name);
> -- 
> 2.19.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ