Skip to content

Commit

Permalink
rcu: trace fix possible mem-leak
Browse files Browse the repository at this point in the history
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>
Reviewed-by: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
  • Loading branch information
Steven Rostedt authored and Ingo Molnar committed Aug 15, 2008
1 parent dd0078f commit 5802294
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion kernel/rcupreempt_trace.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,11 +308,16 @@ static int rcupreempt_debugfs_init(void)

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)
Expand Down

0 comments on commit 5802294

Please sign in to comment.