OSDN Git Service
(root)
/
android-x86
/
kernel.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
372e0d0
)
ftrace: Check for successful allocation of hash
author
Naveen N. Rao
<naveen.n.rao@linux.vnet.ibm.com>
Thu, 4 Jul 2019 14:34:42 +0000
(20:04 +0530)
committer
Steven Rostedt (VMware)
<rostedt@goodmis.org>
Fri, 30 Aug 2019 20:49:07 +0000
(16:49 -0400)
In register_ftrace_function_probe(), we are not checking the return
value of alloc_and_copy_ftrace_hash(). The subsequent call to
ftrace_match_records() may end up dereferencing the same. Add a check to
ensure this doesn't happen.
Link:
http://lkml.kernel.org/r/26e92574f25ad23e7cafa3cf5f7a819de1832cbe.1562249521.git.naveen.n.rao@linux.vnet.ibm.com
Cc: stable@vger.kernel.org
Fixes:
1ec3a81a0cf42
("ftrace: Have each function probe use its own ftrace_ops")
Signed-off-by: Naveen N. Rao <naveen.n.rao@linux.vnet.ibm.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
kernel/trace/ftrace.c
patch
|
blob
|
history
diff --git
a/kernel/trace/ftrace.c
b/kernel/trace/ftrace.c
index
6200a6f
..
f9821a3
100644
(file)
--- a/
kernel/trace/ftrace.c
+++ b/
kernel/trace/ftrace.c
@@
-4338,6
+4338,11
@@
register_ftrace_function_probe(char *glob, struct trace_array *tr,
old_hash = *orig_hash;
hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS, old_hash);
+ if (!hash) {
+ ret = -ENOMEM;
+ goto out;
+ }
+
ret = ftrace_match_records(hash, glob, strlen(glob));
/* Nothing found? */