mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>
Subject: [for-next][PATCH] tracing: Fix memory leak on instance deletion
Date: Sat, 7 Jun 2014 21:42:17 -0400	[thread overview]
Message-ID: <20140607214217.403e3b87@gandalf.local.home> (raw)


Ug, found a memory leak in instance deletion. Missed freeing the
snapshot buffer.

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
for-next

Head SHA1: 17f83bffd1b41b5cd6fe08ad12c8a69341542ba2


Steven Rostedt (Red Hat) (1)
      tracing: Fix memory leak on instance deletion

----
 trace.c |    3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
---------------------------
commit a9fcaaac37b3baba1343f906f52aeb65c4d4e356
Author: Steven Rostedt (Red Hat) <rostedt@goodmis.org>
Date:   Fri Jun 6 23:17:28 2014 -0400

    tracing: Fix memory leak on instance deletion
    
    When an instance is created, it also gets a snapshot ring buffer
    allocated (with minimum of pages). But when it is deleted the snapshot
    buffer is not. There was a helper function added to match the allocation
    of these ring buffers to a way to free them, but it wasn't used by
    the deletion of an instance. Using that helper function solves this
    memory leak.
    
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 26cfff38e2ab..16f7038d1f4d 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -6349,8 +6349,7 @@ static int instance_delete(const char *name)
 	event_trace_del_tracer(tr);
 	ftrace_destroy_function_files(tr);
 	debugfs_remove_recursive(tr->dir);
-	free_percpu(tr->trace_buffer.data);
-	ring_buffer_free(tr->trace_buffer.buffer);
+	free_trace_buffers(tr);
 
 	kfree(tr->name);
 	kfree(tr);

                 reply	other threads:[~2014-06-08  1:42 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20140607214217.403e3b87@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®