All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
To: Carsten Emde <C.Emde@osadl.org>
Cc: Nicholas Mc Guire <der.herr@hofr.at>,
	Thomas Gleixner <tglx@linutronix.de>,
	RT-users <linux-rt-users@vger.kernel.org>
Subject: Re: [PATCH 1/1] tracing/latency_hist Fix memory leak
Date: Fri, 14 Feb 2014 20:59:37 +0100	[thread overview]
Message-ID: <52FE75A9.6050305@linutronix.de> (raw)
In-Reply-To: <20140214172751.776971499@osadl.org>

On 02/14/2014 06:26 PM, Carsten Emde wrote:
> The index_ptr memory that is allocated when printout is started
> currently is only returned when the printout is stopped
> prematurely. It is not returned when the printout regularly
> finishes. Fix this memory leak.
> 
> Signed-off-by: Carsten Emde <C.Emde@osadl.org>
> 
> Index: linux-3.12.10-rt15-somedebug/kernel/trace/latency_hist.c
> ===================================================================
> --- linux-3.12.10-rt15-somedebug.orig/kernel/trace/latency_hist.c
> +++ linux-3.12.10-rt15-somedebug/kernel/trace/latency_hist.c
> @@ -313,6 +313,7 @@ static void *l_next(struct seq_file *m, 
>  
>  	if (++*pos >= MAX_ENTRY_NUM) {
>  		atomic_inc(&my_hist->hist_mode);
> +		kfree(p);
>  		return NULL;
>  	}
>  	*index_ptr = *pos;

Sure on that? If I look at seq_read() I see that there is that ->stop()
is always called after ->start() / ->next() before returning to caller.
Based on this I would say that this patach will introduce a double free
of p.

> 
Sebastian

  reply	other threads:[~2014-02-14 19:59 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-14 17:26 [PATCH 0/1] Fix a small memory leak in latency histograms Carsten Emde
2014-02-14 17:26 ` [PATCH 1/1] tracing/latency_hist Fix memory leak Carsten Emde
2014-02-14 19:59   ` Sebastian Andrzej Siewior [this message]
2014-02-14 20:28     ` Carsten Emde

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52FE75A9.6050305@linutronix.de \
    --to=bigeasy@linutronix.de \
    --cc=C.Emde@osadl.org \
    --cc=der.herr@hofr.at \
    --cc=linux-rt-users@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.