Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8cd995b6 authored by Li Zefan's avatar Li Zefan Committed by Steven Rostedt
Browse files

tracing/filters: add missing unlock in a failure path



[ Impact: fix deadlock in a rare case we fail to allocate memory ]

Signed-off-by: default avatarLi Zefan <lizf@cn.fujitsu.com>
LKML-Reference: <4A0CDC6F.7070200@cn.fujitsu.com>
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
parent 1ec7c484
Loading
Loading
Loading
Loading
+6 −4
Original line number Diff line number Diff line
@@ -1079,9 +1079,10 @@ int apply_event_filter(struct ftrace_event_call *call, char *filter_string)
		return 0;
	}

	err = -ENOMEM;
	ps = kzalloc(sizeof(*ps), GFP_KERNEL);
	if (!ps)
		return -ENOMEM;
		goto out_unlock;

	filter_disable_preds(call);
	replace_filter_string(call->filter, filter_string);
@@ -1101,7 +1102,7 @@ int apply_event_filter(struct ftrace_event_call *call, char *filter_string)
	filter_opstack_clear(ps);
	postfix_clear(ps);
	kfree(ps);

out_unlock:
	mutex_unlock(&filter_mutex);

	return err;
@@ -1123,9 +1124,10 @@ int apply_subsystem_event_filter(struct event_subsystem *system,
		return 0;
	}

	err = -ENOMEM;
	ps = kzalloc(sizeof(*ps), GFP_KERNEL);
	if (!ps)
		return -ENOMEM;
		goto out_unlock;

	filter_free_subsystem_preds(system);
	replace_filter_string(system->filter, filter_string);
@@ -1145,7 +1147,7 @@ int apply_subsystem_event_filter(struct event_subsystem *system,
	filter_opstack_clear(ps);
	postfix_clear(ps);
	kfree(ps);

out_unlock:
	mutex_unlock(&filter_mutex);

	return err;