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: <84df7ef3-0a36-0929-3fa9-74ab773ca12e@linux.intel.com>
Date:   Tue, 8 Sep 2020 09:41:01 -0500
From:   "Zanussi, Tom" <tom.zanussi@...ux.intel.com>
To:     trix@...hat.com, rostedt@...dmis.org, mingo@...hat.com,
        natechancellor@...il.com, ndesaulniers@...gle.com,
        baohong.liu@...el.com
Cc:     linux-kernel@...r.kernel.org, clang-built-linux@...glegroups.com
Subject: Re: [PATCH] tracing: fix double free

Hi Tom,

On 9/7/2020 8:58 AM, trix@...hat.com wrote:
> From: Tom Rix <trix@...hat.com>
> 
> clang static analyzer reports this problem
> 
> trace_events_hist.c:3824:3: warning: Attempt to free
>    released memory
>      kfree(hist_data->attrs->var_defs.name[i]);
> 
> In parse_var_defs() if there is a problem allocating
> var_defs.expr, the earlier var_defs.name is freed.
> This free is duplicated by free_var_defs() which frees
> the rest of the list.
> 
> Because free_var_defs() has to run anyway, remove the
> second free fom parse_var_defs().
> 
> Fixes: 30350d65ac56 ("tracing: Add variable support to hist triggers")
> Signed-off-by: Tom Rix <trix@...hat.com>

Good catch, thanks for fixing this!

Reviewed-by: Tom Zanussi <tom.zanussi@...ux.intel.com>

> ---
>   kernel/trace/trace_events_hist.c | 1 -
>   1 file changed, 1 deletion(-)
> 
> diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> index 0b933546142e..1b2ef6490229 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -3865,7 +3865,6 @@ static int parse_var_defs(struct hist_trigger_data *hist_data)
>   
>   			s = kstrdup(field_str, GFP_KERNEL);
>   			if (!s) {
> -				kfree(hist_data->attrs->var_defs.name[n_vars]);
>   				ret = -ENOMEM;
>   				goto free;
>   			}
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ