[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20080801211128.GF14851@linux.vnet.ibm.com>
Date: Fri, 1 Aug 2008 14:11:28 -0700
From: "Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>
To: Steven Rostedt <rostedt@...dmis.org>
Cc: Ingo Molnar <mingo@...e.hu>, Peter Zijlstra <peterz@...radead.org>,
Thomas Gleixner <tglx@...utronix.de>,
Andrew Morton <akpm@...ux-foundation.org>,
linux-kernel@...r.kernel.org, Steven Rostedt <srostedt@...hat.com>
Subject: Re: [PATCH 2/2] rcu: trace fix possible mem-leak
On Wed, Jul 30, 2008 at 02:20:55PM -0400, Steven Rostedt wrote:
> 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.
Looks good as well!
Reviewed-by: Paul E. McKenney <paulmck@...ux.vnet.ibm.com>
> Signed-off-by: Steven Rostedt <srostedt@...hat.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)
>
> --
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists