On Fri, 06 Jun 2014 12:30:38 -0400, Steven Rostedt wrote: > From: Yoshihiro YUNOMAE <yoshihiro.yunomae...@hitachi.com> > > ftrace_trace_arrays links global_trace.list. However, global_trace > is not added to ftrace_trace_arrays if trace_alloc_buffers() failed. > As the result, ftrace_trace_arrays becomes an empty list. If > ftrace_trace_arrays is an empty list, current top_trace_array() returns > an invalid pointer. As the result, the kernel can induce memory corruption > or panic. > > Current implementation does not check whether ftrace_trace_arrays is empty > list or not. So, in this patch, if ftrace_trace_arrays is empty list, > top_trace_array() returns NULL. Moreover, this patch makes all functions > calling top_trace_array() handle it appropriately.
[SNIP] > @@ -252,6 +252,9 @@ static inline struct trace_array *top_trace_array(void) > { > struct trace_array *tr; > > + if (list_empty(ftrace_trace_arrays.prev)) > + return NULL; It looks weird to me.. why not checking "list_empty(&ftrace_trace_arrays)"? Thanks, Namhyung > + > tr = list_entry(ftrace_trace_arrays.prev, > typeof(*tr), list); > WARN_ON(!(tr->flags & TRACE_ARRAY_FL_GLOBAL)); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/