From: Qiujun Huang <hqjagain@gmail.com>
To: rostedt@goodmis.org, mingo@redhat.com, linux-kernel@vger.kernel.org
Cc: Qiujun Huang <hqjagain@gmail.com>
Subject: [PATCH v2] tracing: Fix out of bounds write in get_trace_buf
Date: Thu, 29 Oct 2020 23:31:40 +0800 [thread overview]
Message-ID: <20201029153140.3643-1-hqjagain@gmail.com> (raw)
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
reply other threads:[~2020-10-29 15:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201029153140.3643-1-hqjagain@gmail.com \
--to=hqjagain@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=rostedt@goodmis.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).