All of lore.kernel.org
 help / color / mirror / Atom feed
* [GIT PULL][v3.6] tracing: Check for allocation failure in __tracing_open()
@ 2012-07-12 16:24 Steven Rostedt
  2012-07-18  9:18 ` Ingo Molnar
  0 siblings, 1 reply; 2+ messages in thread
From: Steven Rostedt @ 2012-07-12 16:24 UTC (permalink / raw)
  To: LKML; +Cc: Ingo Molnar, Andrew Morton, Frederic Weisbecker, Dan Carpenter


Ingo,

Dan found a bug that is in the queue for 3.6. Please add this for the
3.6 queue.

Thanks,

Steve

Please pull the latest tip/perf/core tree, which can be found at:

  git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
tip/perf/core

Head SHA1: 93574fcc5b50cc7b8834698acb2ce947e5b6a5dc


Dan Carpenter (1):
      tracing: Check for allocation failure in __tracing_open()

----
 kernel/trace/trace.c |    4 ++++
 1 file changed, 4 insertions(+)
---------------------------
commit 93574fcc5b50cc7b8834698acb2ce947e5b6a5dc
Author: Dan Carpenter <dan.carpenter@oracle.com>
Date:   Wed Jul 11 09:35:08 2012 +0300

    tracing: Check for allocation failure in __tracing_open()
    
    Clean up and return -ENOMEM on if the kzalloc() fails.
    
    This also prevents a potential crash, as the pointer that failed to
    allocate would be later used.
    
    Link: http://lkml.kernel.org/r/20120711063507.GF11812@elgon.mountain
    
    Cc: Frederic Weisbecker <fweisbec@gmail.com>
    Cc: Ingo Molnar <mingo@redhat.com>
    Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
    Signed-off-by: Steven Rostedt <rostedt@goodmis.org>

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 814ff30..a120f98 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -2390,6 +2390,9 @@ __tracing_open(struct inode *inode, struct file *file)
 
 	iter->buffer_iter = kzalloc(sizeof(*iter->buffer_iter) * num_possible_cpus(),
 				    GFP_KERNEL);
+	if (!iter->buffer_iter)
+		goto release;
+
 	/*
 	 * We make a copy of the current tracer to avoid concurrent
 	 * changes on it while we are reading.
@@ -2451,6 +2454,7 @@ __tracing_open(struct inode *inode, struct file *file)
 	mutex_unlock(&trace_types_lock);
 	kfree(iter->trace);
 	kfree(iter->buffer_iter);
+release:
 	seq_release_private(inode, file);
 	return ERR_PTR(-ENOMEM);
 }



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [GIT PULL][v3.6] tracing: Check for allocation failure in __tracing_open()
  2012-07-12 16:24 [GIT PULL][v3.6] tracing: Check for allocation failure in __tracing_open() Steven Rostedt
@ 2012-07-18  9:18 ` Ingo Molnar
  0 siblings, 0 replies; 2+ messages in thread
From: Ingo Molnar @ 2012-07-18  9:18 UTC (permalink / raw)
  To: Steven Rostedt
  Cc: LKML, Ingo Molnar, Andrew Morton, Frederic Weisbecker, Dan Carpenter


* Steven Rostedt <rostedt@goodmis.org> wrote:

> Ingo,
> 
> Dan found a bug that is in the queue for 3.6. Please add this for the
> 3.6 queue.
> 
> Thanks,
> 
> Steve
> 
> Please pull the latest tip/perf/core tree, which can be found at:
> 
>   git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace.git
> tip/perf/core
> 
> Head SHA1: 93574fcc5b50cc7b8834698acb2ce947e5b6a5dc
> 
> 
> Dan Carpenter (1):
>       tracing: Check for allocation failure in __tracing_open()
> 
> ----
>  kernel/trace/trace.c |    4 ++++
>  1 file changed, 4 insertions(+)

Pulled, thanks Steve!

	Ingo

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-07-18  9:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-07-12 16:24 [GIT PULL][v3.6] tracing: Check for allocation failure in __tracing_open() Steven Rostedt
2012-07-18  9:18 ` Ingo Molnar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.