Skip to contentSkip to conversation

tracing: Fix in out of bounds write in get_trace_buf

PATCH Superseded Qiujun Huang 1 participant 1 message Oct 29, 2020 Tracing

v1 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tracing: Fix in out of bounds write in get_trace_buf

The boundary condition should be 3 as we access
buffer[buffer->nesting][0].

Fixes e2ace001176dc ("tracing: Choose static tp_printk buffer by explicit nesting count")
---
 kernel/trace/trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/trace/trace.c +1 -1
index 528971714fc6..196a4b7de48a 100644
@@ -3125,7 +3125,7 @@ static char *get_trace_buf(void)
 {
 	struct trace_buffer_struct *buffer = this_cpu_ptr(trace_percpu_buffer);
 
-	if (!buffer || buffer->nesting >= 4)
+	if (!buffer || buffer->nesting >= 3)
 		return NULL;
 
 	buffer->nesting++;
Signature · 1 line
2.17.1