|
@@ -3146,8 +3146,10 @@ ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len,
|
|
|
mutex_lock(&ftrace_regex_lock);
|
|
|
if (reset)
|
|
|
ftrace_filter_reset(hash);
|
|
|
- if (buf)
|
|
|
- ftrace_match_records(hash, buf, len);
|
|
|
+ if (buf && !ftrace_match_records(hash, buf, len)) {
|
|
|
+ ret = -EINVAL;
|
|
|
+ goto out_regex_unlock;
|
|
|
+ }
|
|
|
|
|
|
mutex_lock(&ftrace_lock);
|
|
|
ret = ftrace_hash_move(ops, enable, orig_hash, hash);
|
|
@@ -3157,6 +3159,7 @@ ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len,
|
|
|
|
|
|
mutex_unlock(&ftrace_lock);
|
|
|
|
|
|
+ out_regex_unlock:
|
|
|
mutex_unlock(&ftrace_regex_lock);
|
|
|
|
|
|
free_ftrace_hash(hash);
|
|
@@ -3173,10 +3176,10 @@ ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len,
|
|
|
* Filters denote which functions should be enabled when tracing is enabled.
|
|
|
* If @buf is NULL and reset is set, all functions will be enabled for tracing.
|
|
|
*/
|
|
|
-void ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf,
|
|
|
+int ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf,
|
|
|
int len, int reset)
|
|
|
{
|
|
|
- ftrace_set_regex(ops, buf, len, reset, 1);
|
|
|
+ return ftrace_set_regex(ops, buf, len, reset, 1);
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(ftrace_set_filter);
|
|
|
|
|
@@ -3191,10 +3194,10 @@ EXPORT_SYMBOL_GPL(ftrace_set_filter);
|
|
|
* is enabled. If @buf is NULL and reset is set, all functions will be enabled
|
|
|
* for tracing.
|
|
|
*/
|
|
|
-void ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf,
|
|
|
+int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf,
|
|
|
int len, int reset)
|
|
|
{
|
|
|
- ftrace_set_regex(ops, buf, len, reset, 0);
|
|
|
+ return ftrace_set_regex(ops, buf, len, reset, 0);
|
|
|
}
|
|
|
EXPORT_SYMBOL_GPL(ftrace_set_notrace);
|
|
|
/**
|