mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v2] tracing: Fix out of bounds write in get_trace_buf
@ 2020-10-29 15:31 Qiujun Huang
  0 siblings, 0 replies; only message in thread
From: Qiujun Huang @ 2020-10-29 15:31 UTC (permalink / raw)
  To: rostedt, mingo, linux-kernel; +Cc: Qiujun Huang

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")
Signed-off-by: Qiujun Huang <hqjagain@gmail.com>
---
v2:
Fix a typo in the title.
---
 kernel/trace/trace.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 528971714fc6..196a4b7de48a 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -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++;
-- 
2.17.1


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-10-29 15:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-29 15:31 [PATCH v2] tracing: Fix out of bounds write in get_trace_buf Qiujun Huang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®