mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] RCU trace fix possible mem-leak
@ 2007-10-04 15:16 Steven Rostedt
  0 siblings, 0 replies; only message in thread
From: Steven Rostedt @ 2007-10-04 15:16 UTC (permalink / raw)
  To: Paul E. McKenney; +Cc: LKML, RT, Ingo Molnar, Thomas Gleixner, Peter Zijlstra

[ For RCU trace which is not yet in mainline ]

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 <rostedt@goodmis.org>

Index: linux-2.6.23-rc9-rt1/kernel/rcupreempt_trace.c
===================================================================
--- linux-2.6.23-rc9-rt1.orig/kernel/rcupreempt_trace.c
+++ linux-2.6.23-rc9-rt1/kernel/rcupreempt_trace.c
@@ -309,11 +309,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)



^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2007-10-04 15:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-04 15:16 [PATCH] RCU trace fix possible mem-leak Steven Rostedt

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®