diff --git a/include/linux/tracepoint.h b/include/linux/tracepoint.h index 660a9de96f81dba7ca358b8c4e952dc32df1e05f..2aac8a83e89b9a7994b7570ffb3ea879d763ee23 100644 --- a/include/linux/tracepoint.h +++ b/include/linux/tracepoint.h @@ -36,7 +36,7 @@ struct tracepoint { #ifndef DECLARE_TRACE #define TP_PROTO(args...) args -#define TP_ARGS(args...) args +#define TP_ARGS(args...) args #ifdef CONFIG_TRACEPOINTS diff --git a/include/trace/events/workqueue.h b/include/trace/events/workqueue.h index fcfd9a1e4b9640a7c4d3e26c44f2aac38e3b6810..e4612dbd7ba6070d3d2a28e8a7f4359524cbe77c 100644 --- a/include/trace/events/workqueue.h +++ b/include/trace/events/workqueue.h @@ -26,7 +26,7 @@ TRACE_EVENT(workqueue_insertion, __entry->func = work->func; ), - TP_printk("thread=%s:%d func=%pF", __entry->thread_comm, + TP_printk("thread=%s:%d func=%pf", __entry->thread_comm, __entry->thread_pid, __entry->func) ); @@ -48,7 +48,7 @@ TRACE_EVENT(workqueue_execution, __entry->func = work->func; ), - TP_printk("thread=%s:%d func=%pF", __entry->thread_comm, + TP_printk("thread=%s:%d func=%pf", __entry->thread_comm, __entry->thread_pid, __entry->func) ); diff --git a/kernel/module.c b/kernel/module.c index 5a29397ca4b6f1633e91b8b94cfdac14f2071ff9..fe748a86d452030b8d44fcb7731c1badeb93c33c 100644 --- a/kernel/module.c +++ b/kernel/module.c @@ -3091,7 +3091,6 @@ void module_layout(struct module *mod, struct modversion_info *ver, struct kernel_param *kp, struct kernel_symbol *ks, - struct marker *marker, struct tracepoint *tp) { } diff --git a/kernel/trace/ftrace.c b/kernel/trace/ftrace.c index a142579765bf6635ef8f426ac2e3f99b95daaaf0..46592feab5a6b0cf47e5cc147f43e1669efcf712 100644 --- a/kernel/trace/ftrace.c +++ b/kernel/trace/ftrace.c @@ -1621,8 +1621,10 @@ ftrace_regex_open(struct inode *inode, struct file *file, int enable) if (!ret) { struct seq_file *m = file->private_data; m->private = iter; - } else + } else { + trace_parser_put(&iter->parser); kfree(iter); + } } else file->private_data = iter; mutex_unlock(&ftrace_regex_lock); @@ -2202,7 +2204,7 @@ ftrace_regex_write(struct file *file, const char __user *ubuf, struct trace_parser *parser; ssize_t ret, read; - if (!cnt || cnt < 0) + if (!cnt) return 0; mutex_lock(&ftrace_regex_lock); @@ -2216,7 +2218,7 @@ ftrace_regex_write(struct file *file, const char __user *ubuf, parser = &iter->parser; read = trace_get_user(parser, ubuf, cnt, ppos); - if (trace_parser_loaded(parser) && + if (read >= 0 && trace_parser_loaded(parser) && !trace_parser_cont(parser)) { ret = ftrace_process_regex(parser->buffer, parser->idx, enable); @@ -2552,8 +2554,7 @@ ftrace_graph_write(struct file *file, const char __user *ubuf, size_t cnt, loff_t *ppos) { struct trace_parser parser; - size_t read = 0; - ssize_t ret; + ssize_t read, ret; if (!cnt || cnt < 0) return 0; @@ -2562,29 +2563,31 @@ ftrace_graph_write(struct file *file, const char __user *ubuf, if (ftrace_graph_count >= FTRACE_GRAPH_MAX_FUNCS) { ret = -EBUSY; - goto out; + goto out_unlock; } if (trace_parser_get_init(&parser, FTRACE_BUFF_MAX)) { ret = -ENOMEM; - goto out; + goto out_unlock; } read = trace_get_user(&parser, ubuf, cnt, ppos); - if (trace_parser_loaded((&parser))) { + if (read >= 0 && trace_parser_loaded((&parser))) { parser.buffer[parser.idx] = 0; /* we allow only one expression at a time */ ret = ftrace_set_func(ftrace_graph_funcs, &ftrace_graph_count, parser.buffer); if (ret) - goto out; + goto out_free; } ret = read; - out: + +out_free: trace_parser_put(&parser); +out_unlock: mutex_unlock(&graph_lock); return ret; diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c index 411af37f4be4755b2bb1670d7cef18d16fc39c94..45068269ebb1746673f23c20b146ca9104a0b325 100644 --- a/kernel/trace/trace.c +++ b/kernel/trace/trace.c @@ -415,7 +415,7 @@ int trace_get_user(struct trace_parser *parser, const char __user *ubuf, /* read the non-space input */ while (cnt && !isspace(ch)) { - if (parser->idx < parser->size) + if (parser->idx < parser->size - 1) parser->buffer[parser->idx++] = ch; else { ret = -EINVAL; diff --git a/kernel/trace/trace_events.c b/kernel/trace/trace_events.c index 6f03c8a1105e925f7604b7aaeac21e6486cb7c4f..d128f65778e69654207c6d8d7b987bc7837f7541 100644 --- a/kernel/trace/trace_events.c +++ b/kernel/trace/trace_events.c @@ -232,10 +232,9 @@ ftrace_event_write(struct file *file, const char __user *ubuf, size_t cnt, loff_t *ppos) { struct trace_parser parser; - size_t read = 0; - ssize_t ret; + ssize_t read, ret; - if (!cnt || cnt < 0) + if (!cnt) return 0; ret = tracing_update_buffers(); @@ -247,7 +246,7 @@ ftrace_event_write(struct file *file, const char __user *ubuf, read = trace_get_user(&parser, ubuf, cnt, ppos); - if (trace_parser_loaded((&parser))) { + if (read >= 0 && trace_parser_loaded((&parser))) { int set = 1; if (*parser.buffer == '!')