Two tracing fixes:
- Add mutex protection to ring_buffer_reset() - Fix deadlock in modify_ftrace_direct_multi() -----BEGIN PGP SIGNATURE----- iIoEABYIADIWIQRRSw7ePDh/lE+zeZMp5XQQmuv6qgUCYY0ivBQccm9zdGVkdEBn b29kbWlzLm9yZwAKCRAp5XQQmuv6qhAvAPsHNmAXJ32HuOgVrTCm4WxOSDdukri+ E5KirCzp0jtQQwEAxwz8neUalfZ8RQyHdpDe9vP9Ay0lCjbfrPxD0DUtiQE= =VwcI -----END PGP SIGNATURE----- Merge tag 'trace-v5.16-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace Pull tracing fixes from Steven Rostedt: "Two locking fixes: - Add mutex protection to ring_buffer_reset() - Fix deadlock in modify_ftrace_direct_multi()" * tag 'trace-v5.16-3' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: ftrace/direct: Fix lockup in modify_ftrace_direct_multi ring-buffer: Protect ring_buffer_reset() from reentrancy
This commit is contained in:
commit
600b18f88f
|
@ -5602,10 +5602,11 @@ int modify_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mutex_unlock(&ftrace_lock);
|
||||||
|
|
||||||
/* Removing the tmp_ops will add the updated direct callers to the functions */
|
/* Removing the tmp_ops will add the updated direct callers to the functions */
|
||||||
unregister_ftrace_function(&tmp_ops);
|
unregister_ftrace_function(&tmp_ops);
|
||||||
|
|
||||||
mutex_unlock(&ftrace_lock);
|
|
||||||
out_direct:
|
out_direct:
|
||||||
mutex_unlock(&direct_mutex);
|
mutex_unlock(&direct_mutex);
|
||||||
return err;
|
return err;
|
||||||
|
|
|
@ -5228,6 +5228,9 @@ void ring_buffer_reset(struct trace_buffer *buffer)
|
||||||
struct ring_buffer_per_cpu *cpu_buffer;
|
struct ring_buffer_per_cpu *cpu_buffer;
|
||||||
int cpu;
|
int cpu;
|
||||||
|
|
||||||
|
/* prevent another thread from changing buffer sizes */
|
||||||
|
mutex_lock(&buffer->mutex);
|
||||||
|
|
||||||
for_each_buffer_cpu(buffer, cpu) {
|
for_each_buffer_cpu(buffer, cpu) {
|
||||||
cpu_buffer = buffer->buffers[cpu];
|
cpu_buffer = buffer->buffers[cpu];
|
||||||
|
|
||||||
|
@ -5246,6 +5249,8 @@ void ring_buffer_reset(struct trace_buffer *buffer)
|
||||||
atomic_dec(&cpu_buffer->record_disabled);
|
atomic_dec(&cpu_buffer->record_disabled);
|
||||||
atomic_dec(&cpu_buffer->resize_disabled);
|
atomic_dec(&cpu_buffer->resize_disabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
mutex_unlock(&buffer->mutex);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(ring_buffer_reset);
|
EXPORT_SYMBOL_GPL(ring_buffer_reset);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue