summaryrefslogtreecommitdiff
path: root/kernel
diff options
context:
space:
mode:
authorShaohua Li <shaohua.li@intel.com>2010-07-27 16:06:34 +0800
committerGreg Kroah-Hartman <gregkh@suse.de>2010-08-26 16:45:48 -0700
commitee384c27819972c620c2eec0545b9f1472cbe0ab (patch)
treea6bc46e4073c931eb72c78edc4dbbcd344f4277a /kernel
parent3ab47fa1a288f370ced9e9575655151df20c04fc (diff)
tracing: Fix an unallocated memory access in function_graph
commit 575570f02761bd680ba5731c1dfd4701062e7fb2 upstream. With CONFIG_DEBUG_PAGEALLOC, I observed an unallocated memory access in function_graph trace. It appears we find a small size entry in ring buffer, but we access it as a big size entry. The access overflows the page size and touches an unallocated page. Signed-off-by: Shaohua Li <shaohua.li@intel.com> LKML-Reference: <1280217994.32400.76.camel@sli10-desk.sh.intel.com> [ Added a comment to explain the problem - SDR ] Signed-off-by: Steven Rostedt <rostedt@goodmis.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/trace/trace_functions_graph.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/kernel/trace/trace_functions_graph.c b/kernel/trace/trace_functions_graph.c
index 79f4bac99a94..b4c179ae4e45 100644
--- a/kernel/trace/trace_functions_graph.c
+++ b/kernel/trace/trace_functions_graph.c
@@ -507,7 +507,15 @@ get_return_for_leaf(struct trace_iterator *iter,
* if the output fails.
*/
data->ent = *curr;
- data->ret = *next;
+ /*
+ * If the next event is not a return type, then
+ * we only care about what type it is. Otherwise we can
+ * safely copy the entire event.
+ */
+ if (next->ent.type == TRACE_GRAPH_RET)
+ data->ret = *next;
+ else
+ data->ret.ent.type = next->ent.type;
}
}