[for-next][PATCH 12/12] ftrace: Unlock hash mutex on failed allocation in process_mod_list()

From: Steven Rostedt
Date: Thu Jun 29 2017 - 20:41:32 EST


From: "Steven Rostedt (VMware)" <rostedt@xxxxxxxxxxx>

If the new_hash fails to allocate, then unlock the hash mutex on error.

Reported-by: Julia Lawall <julia.lawall@xxxxxxx>
Signed-off-by: Steven Rostedt (VMware) <rostedt@xxxxxxxxxxx>
---
kernel/trace/ftrace.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c
index 7509ef9810bf..2c79630cd267 100644
--- a/kernel/trace/ftrace.c
+++ b/kernel/trace/ftrace.c
@@ -3997,7 +3997,7 @@ static void process_mod_list(struct list_head *head, struct ftrace_ops *ops,
new_hash = alloc_and_copy_ftrace_hash(FTRACE_HASH_DEFAULT_BITS,
*orig_hash);
if (!new_hash)
- return; /* Warn? */
+ goto out; /* warn? */

mutex_lock(&ftrace_lock);

@@ -4042,6 +4042,7 @@ static void process_mod_list(struct list_head *head, struct ftrace_ops *ops,
new_hash, enable);
mutex_unlock(&ftrace_lock);

+ out:
mutex_unlock(&ops->func_hash->regex_lock);

free_ftrace_hash(new_hash);
--
2.10.2