Lock kprobe_mutex while showing kprobe_blacklist to prevent updating the kprobe_blacklist.
Unified · Split
| @@ -2420,6 +2420,7 @@ static const struct file_operations debugfs_kprobes_operations = { · 2419 unmodified lines | ||
| 2420 | 2420 | /* kprobes/blacklist -- shows which functions can not be probed */ |
| 2421 | 2421 | static void *kprobe_blacklist_seq_start(struct seq_file *m, loff_t *pos) |
| 2422 | 2422 | { |
| 2423 | + mutex_lock(&kprobe_mutex); | |
| 2423 | 2424 | return seq_list_start(&kprobe_blacklist, *pos); |
| 2424 | 2425 | } |
| 2425 | 2426 | |
| @@ -2446,10 +2447,15 @@ static int kprobe_blacklist_seq_show(struct seq_file *m, void *v) · 20 unmodified lines | ||
| 2446 | 2447 | return 0; |
| 2447 | 2448 | } |
| 2448 | 2449 | |
| 2450 | +static void kprobe_blacklist_seq_stop(struct seq_file *f, void *v) | |
| 2451 | +{ | |
| 2452 | + mutex_unlock(&kprobe_mutex); | |
| 2453 | +} | |
| 2454 | + | |
| 2449 | 2455 | static const struct seq_operations kprobe_blacklist_seq_ops = { |
| 2450 | 2456 | .start = kprobe_blacklist_seq_start, |
| 2451 | 2457 | .next = kprobe_blacklist_seq_next, |
| 2452 | − .stop = kprobe_seq_stop, /* Reuse void function */ | |
| 2458 | + .stop = kprobe_blacklist_seq_stop, | |
| 2453 | 2459 | .show = kprobe_blacklist_seq_show, |
| 2454 | 2460 | }; |
| 2455 | 2461 | |