Commit 5b0022dd authored by Naveen N. Rao's avatar Naveen N. Rao Committed by Steven Rostedt (VMware)
Browse files

ftrace: Check for successful allocation of hash

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.


Fixes: 1ec3a81a

 ("ftrace: Have each function probe use its own ftrace_ops")
Signed-off-by: default avatarNaveen N. Rao <>
Signed-off-by: default avatarSteven Rostedt (VMware) <>
parent 372e0d01
......@@ -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? */
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment