diff options
-rw-r--r-- | include/linux/ftrace.h | 4 | ||||
-rw-r--r-- | kernel/trace/ftrace.c | 15 |
2 files changed, 11 insertions, 8 deletions
diff --git a/include/linux/ftrace.h b/include/linux/ftrace.h index 028e26f0bf08..f33fb3b041c6 100644 --- a/include/linux/ftrace.h +++ b/include/linux/ftrace.h | |||
@@ -178,9 +178,9 @@ struct dyn_ftrace { | |||
178 | }; | 178 | }; |
179 | 179 | ||
180 | int ftrace_force_update(void); | 180 | int ftrace_force_update(void); |
181 | void ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf, | 181 | int ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf, |
182 | int len, int reset); | 182 | int len, int reset); |
183 | void ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, | 183 | int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, |
184 | int len, int reset); | 184 | int len, int reset); |
185 | void ftrace_set_global_filter(unsigned char *buf, int len, int reset); | 185 | void ftrace_set_global_filter(unsigned char *buf, int len, int reset); |
186 | void ftrace_set_global_notrace(unsigned char *buf, int len, int reset); | 186 | void ftrace_set_global_notrace(unsigned char *buf, int len, int reset); |
diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index 683d559a0eef..e2e0597c0845 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c | |||
@@ -3146,8 +3146,10 @@ ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len, | |||
3146 | mutex_lock(&ftrace_regex_lock); | 3146 | mutex_lock(&ftrace_regex_lock); |
3147 | if (reset) | 3147 | if (reset) |
3148 | ftrace_filter_reset(hash); | 3148 | ftrace_filter_reset(hash); |
3149 | if (buf) | 3149 | if (buf && !ftrace_match_records(hash, buf, len)) { |
3150 | ftrace_match_records(hash, buf, len); | 3150 | ret = -EINVAL; |
3151 | goto out_regex_unlock; | ||
3152 | } | ||
3151 | 3153 | ||
3152 | mutex_lock(&ftrace_lock); | 3154 | mutex_lock(&ftrace_lock); |
3153 | ret = ftrace_hash_move(ops, enable, orig_hash, hash); | 3155 | 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, | |||
3157 | 3159 | ||
3158 | mutex_unlock(&ftrace_lock); | 3160 | mutex_unlock(&ftrace_lock); |
3159 | 3161 | ||
3162 | out_regex_unlock: | ||
3160 | mutex_unlock(&ftrace_regex_lock); | 3163 | mutex_unlock(&ftrace_regex_lock); |
3161 | 3164 | ||
3162 | free_ftrace_hash(hash); | 3165 | free_ftrace_hash(hash); |
@@ -3173,10 +3176,10 @@ ftrace_set_regex(struct ftrace_ops *ops, unsigned char *buf, int len, | |||
3173 | * Filters denote which functions should be enabled when tracing is enabled. | 3176 | * Filters denote which functions should be enabled when tracing is enabled. |
3174 | * If @buf is NULL and reset is set, all functions will be enabled for tracing. | 3177 | * If @buf is NULL and reset is set, all functions will be enabled for tracing. |
3175 | */ | 3178 | */ |
3176 | void ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf, | 3179 | int ftrace_set_filter(struct ftrace_ops *ops, unsigned char *buf, |
3177 | int len, int reset) | 3180 | int len, int reset) |
3178 | { | 3181 | { |
3179 | ftrace_set_regex(ops, buf, len, reset, 1); | 3182 | return ftrace_set_regex(ops, buf, len, reset, 1); |
3180 | } | 3183 | } |
3181 | EXPORT_SYMBOL_GPL(ftrace_set_filter); | 3184 | EXPORT_SYMBOL_GPL(ftrace_set_filter); |
3182 | 3185 | ||
@@ -3191,10 +3194,10 @@ EXPORT_SYMBOL_GPL(ftrace_set_filter); | |||
3191 | * is enabled. If @buf is NULL and reset is set, all functions will be enabled | 3194 | * is enabled. If @buf is NULL and reset is set, all functions will be enabled |
3192 | * for tracing. | 3195 | * for tracing. |
3193 | */ | 3196 | */ |
3194 | void ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, | 3197 | int ftrace_set_notrace(struct ftrace_ops *ops, unsigned char *buf, |
3195 | int len, int reset) | 3198 | int len, int reset) |
3196 | { | 3199 | { |
3197 | ftrace_set_regex(ops, buf, len, reset, 0); | 3200 | return ftrace_set_regex(ops, buf, len, reset, 0); |
3198 | } | 3201 | } |
3199 | EXPORT_SYMBOL_GPL(ftrace_set_notrace); | 3202 | EXPORT_SYMBOL_GPL(ftrace_set_notrace); |
3200 | /** | 3203 | /** |