Pull tracing fixes from Steven Rostedt: - Check for NULL in kretprobe_dispatcher() NULL can now be passed in, make sure it can handle it - Clean up unneeded #endif #ifdef of the same preprocessor check in the middle of the block. - Comment clean up - Remove unneeded initialization of the "ret" variable in __trace_uprobe_create() * tag 'trace-v5.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: tracing/uprobes: Remove unwanted initialization in __trace_uprobe_create() tracefs: Fix syntax errors in comments tracing: Simplify conditional compilation code in tracing_set_tracer() tracing/kprobes: Check whether get_kretprobe() returns NULL in kretprobe_dispatcher()
Showing the changes to kernel (3 of 4 files). Show all
Unified · Split
| @@ -6424,9 +6424,7 @@ int tracing_set_tracer(struct trace_array *tr, const char *buf) · 6423 unmodified lines | ||
| 6424 | 6424 | synchronize_rcu(); |
| 6425 | 6425 | free_snapshot(tr); |
| 6426 | 6426 | } |
| 6427 | −#endif | |
| 6428 | 6427 | |
| 6429 | −#ifdef CONFIG_TRACER_MAX_TRACE | |
| 6430 | 6428 | if (t->use_max_tr && !had_max_tr) { |
| 6431 | 6429 | ret = tracing_alloc_snapshot_instance(tr); |
| 6432 | 6430 | if (ret < 0) |
| @@ -1718,8 +1718,17 @@ static int · 1717 unmodified lines | ||
| 1718 | 1718 | kretprobe_dispatcher(struct kretprobe_instance *ri, struct pt_regs *regs) |
| 1719 | 1719 | { |
| 1720 | 1720 | struct kretprobe *rp = get_kretprobe(ri); |
| 1721 | − struct trace_kprobe *tk = container_of(rp, struct trace_kprobe, rp); | |
| 1721 | + struct trace_kprobe *tk; | |
| 1722 | + | |
| 1723 | + /* | |
| 1724 | + * There is a small chance that get_kretprobe(ri) returns NULL when | |
| 1725 | + * the kretprobe is unregister on another CPU between kretprobe's | |
| 1726 | + * trampoline_handler and this function. | |
| 1727 | + */ | |
| 1728 | + if (unlikely(!rp)) | |
| 1729 | + return 0; | |
| 1722 | 1730 | |
| 1731 | + tk = container_of(rp, struct trace_kprobe, rp); | |
| 1723 | 1732 | raw_cpu_inc(*tk->nhit); |
| 1724 | 1733 | |
| 1725 | 1734 | if (trace_probe_test_flag(&tk->tp, TP_FLAG_TRACE)) |
| @@ -546,7 +546,6 @@ static int __trace_uprobe_create(int argc, const char **argv) · 545 unmodified lines | ||
| 546 | 546 | bool is_return = false; |
| 547 | 547 | int i, ret; |
| 548 | 548 | |
| 549 | − ret = 0; | |
| 550 | 549 | ref_ctr_offset = 0; |
| 551 | 550 | |
| 552 | 551 | switch (argv[0][0]) { |