Skip to content

Commit e77a681

Browse files
committed
Merge tag 'trace-v5.11-rc7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace
Pull tracing fix from Steven Rostedt: "Fix buffer overflow in trace event filter. It was reported that if an trace event was larger than a page and was filtered, that it caused memory corruption. The reason is that filtered events first go into a buffer to test the filter before being written into the ring buffer. Unfortunately, this write did not check the size" * tag 'trace-v5.11-rc7-2' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace: tracing: Check length before giving out the filter buffer
2 parents 2dbbaae + b220c04 commit e77a681

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kernel/trace/trace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2745,7 +2745,7 @@ trace_event_buffer_lock_reserve(struct trace_buffer **current_rb,
27452745
(entry = this_cpu_read(trace_buffered_event))) {
27462746
/* Try to use the per cpu buffer first */
27472747
val = this_cpu_inc_return(trace_buffered_event_cnt);
2748-
if (val == 1) {
2748+
if ((len < (PAGE_SIZE - sizeof(*entry))) && val == 1) {
27492749
trace_event_setup(entry, type, flags, pc);
27502750
entry->array[0] = len;
27512751
return entry;

0 commit comments

Comments
 (0)