[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20201029155714.3935-1-hqjagain@gmail.com>
Date: Thu, 29 Oct 2020 23:57:14 +0800
From: Qiujun Huang <hqjagain@...il.com>
To: rostedt@...dmis.org, mingo@...hat.com, linux-kernel@...r.kernel.org
Cc: Qiujun Huang <hqjagain@...il.com>
Subject: [PATCH v3] tracing: Fix out of bounds write in get_trace_buf
The subscript should be nesting - 1, as nesting had self-added.
Fixes: e2ace001176dc ("tracing: Choose static tp_printk buffer by explicit nesting count")
Signed-off-by: Qiujun Huang <hqjagain@...il.com>
---
v3:
Modify the way of array reference instead.
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..daa96215e294 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3132,7 +3132,7 @@ static char *get_trace_buf(void)
/* Interrupts must see nesting incremented before we use the buffer */
barrier();
- return &buffer->buffer[buffer->nesting][0];
+ return &buffer->buffer[buffer->nesting - 1][0];
}
static void put_trace_buf(void)
--
2.17.1
Powered by blists - more mailing lists