mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
	Ingo Molnar <mingo@elte.hu>,
	Peter Zijlstra <peterz@infradead.org>,
	Thomas Gleixner <tglx@linutronix.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	linux-kernel@vger.kernel.org
Cc: Steven Rostedt <srostedt@redhat.com>
Subject: [PATCH 2/2] rcu: trace fix possible mem-leak
Date: Wed, 30 Jul 2008 14:20:55 -0400	[thread overview]
Message-ID: <20080730182239.523848312@goodmis.org> (raw)
In-Reply-To: <20080730182053.872043059@goodmis.org>

[-- Attachment #1: rcu-trace-fix-free.patch --]
[-- Type: text/plain, Size: 1056 bytes --]

In the initialization of the RCU trace module, if
rcupreempt_debugfs_init() fails, we never free the the trace buffer.

This patch frees the trace buffer in case the debugfs fails.

Signed-off-by: Steven Rostedt <srostedt@redhat.com>
---
 kernel/rcupreempt_trace.c |    7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Index: linux-compile.git/kernel/rcupreempt_trace.c
===================================================================
--- linux-compile.git.orig/kernel/rcupreempt_trace.c	2008-07-15 23:55:47.000000000 -0400
+++ linux-compile.git/kernel/rcupreempt_trace.c	2008-07-30 13:58:41.000000000 -0400
@@ -308,11 +308,16 @@ out:
 
 static int __init rcupreempt_trace_init(void)
 {
+	int ret;
+
 	mutex_init(&rcupreempt_trace_mutex);
 	rcupreempt_trace_buf = kmalloc(RCUPREEMPT_TRACE_BUF_SIZE, GFP_KERNEL);
 	if (!rcupreempt_trace_buf)
 		return 1;
-	return rcupreempt_debugfs_init();
+	ret = rcupreempt_debugfs_init();
+	if (ret)
+		kfree(rcupreempt_trace_buf);
+	return ret;
 }
 
 static void __exit rcupreempt_trace_cleanup(void)

-- 

  parent reply	other threads:[~2008-07-30 18:23 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-07-30 18:20 [PATCH 0/2] RCU preempt updates Steven Rostedt
2008-07-30 18:20 ` [PATCH 1/2] rcu: just rename call_rcu_bh instead of making it a macro Steven Rostedt
2008-08-01 21:11   ` Paul E. McKenney
2008-08-15 15:54     ` Ingo Molnar
2008-07-30 18:20 ` Steven Rostedt [this message]
2008-08-01 21:11   ` [PATCH 2/2] rcu: trace fix possible mem-leak Paul E. McKenney
2008-08-15 15:55     ` Ingo Molnar

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=20080730182239.523848312@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@elte.hu \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    --cc=srostedt@redhat.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

Powered by JetHome