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: <20220125093258.222175c7@gandalf.local.home>
Date:   Tue, 25 Jan 2022 09:32:58 -0500
From:   Steven Rostedt <rostedt@...dmis.org>
To:     xkernel.wang@...mail.com
Cc:     mingo@...hat.com, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] tracing/histogram: fix a potential memory leak for
 kstrdup()

On Tue, 25 Jan 2022 12:07:15 +0800
xkernel.wang@...mail.com wrote:

> From: Xiaoke Wang <xkernel.wang@...mail.com>
> 
> kfree() is missing on an error path to free the memory allocated by
> kstrdup():
> > p = param = kstrdup(data->params[i], GFP_KERNEL);  
> So it is better to free it via kfree(p).
> 

Applied. Thanks,

-- Steve

> Signed-off-by: Xiaoke Wang <xkernel.wang@...mail.com>
> ---
>  kernel/trace/trace_events_hist.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/kernel/trace/trace_events_hist.c b/kernel/trace/trace_events_hist.c
> index f01e442..1fac14c 100644
> --- a/kernel/trace/trace_events_hist.c
> +++ b/kernel/trace/trace_events_hist.c
> @@ -3578,6 +3578,7 @@ static int trace_action_create(struct hist_trigger_data *hist_data,
>  
>  			var_ref_idx = find_var_ref_idx(hist_data, var_ref);
>  			if (WARN_ON(var_ref_idx < 0)) {
> +				kfree(p);
>  				ret = var_ref_idx;
>  				goto err;
>  			}

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ