linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Ingo Molnar <mingo@kernel.org>,
	Andrew Morton <akpm@linux-foundation.org>,
	kbuild test robot <lkp@intel.com>
Subject: [for-next][PATCH 13/14] tracing: Fix uninitialized buffer var on early exit to trace_vbprintk()
Date: Fri, 24 Jan 2020 10:17:04 -0500	[thread overview]
Message-ID: <20200124151726.137118966@goodmis.org> (raw)
In-Reply-To: 20200124151651.852781301@goodmis.org

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

If we exit due to a bad input to trace_printk() (highly unlikely), then the
buffer variable will not be initialized when we unnest the ring buffer.

Reported-by: kbuild test robot <lkp@intel.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 kernel/trace/trace.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index 2e1db19dce97..d1410b4462ac 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3230,7 +3230,7 @@ int trace_vbprintk(unsigned long ip, const char *fmt, va_list args)
 	len = vbin_printf((u32 *)tbuffer, TRACE_BUF_SIZE/sizeof(int), fmt, args);
 
 	if (len > TRACE_BUF_SIZE/sizeof(int) || len < 0)
-		goto out;
+		goto out_put;
 
 	local_save_flags(flags);
 	size = sizeof(*entry) + sizeof(u32) * len;
@@ -3252,6 +3252,7 @@ int trace_vbprintk(unsigned long ip, const char *fmt, va_list args)
 
 out:
 	ring_buffer_nest_end(buffer);
+out_put:
 	put_trace_buf();
 
 out_nobuffer:
-- 
2.24.1



  parent reply	other threads:[~2020-01-24 15:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-01-24 15:16 [for-next][PATCH 00/14] tracing: More updates for 5.6 Steven Rostedt
2020-01-24 15:16 ` [for-next][PATCH 01/14] ring-bufer: kernel-doc warning fixes Steven Rostedt
2020-01-24 15:16 ` [for-next][PATCH 02/14] ring-buffer: Fix kernel doc for rb_update_event() Steven Rostedt
2020-01-24 15:16 ` [for-next][PATCH 03/14] tracing: Allow trace_printk() to nest in other tracing code Steven Rostedt
2020-01-24 15:16 ` [for-next][PATCH 04/14] ftrace: Remove abandoned macros Steven Rostedt
2020-01-24 15:16 ` [for-next][PATCH 05/14] ftrace: Remove NR_TO_INIT macro Steven Rostedt
2020-01-24 15:16 ` [for-next][PATCH 06/14] bootconfig: Fix Kconfig help message for BOOT_CONFIG Steven Rostedt
2020-01-24 15:16 ` [for-next][PATCH 07/14] Documentation: bootconfig: Fix typos in bootconfig documentation Steven Rostedt
2020-01-24 15:16 ` [for-next][PATCH 08/14] Documentation: tracing: Fix typos in boot-time tracing documentation Steven Rostedt
2020-01-24 15:17 ` [for-next][PATCH 09/14] tools: bootconfig: Fix spelling mistake "faile" -> "failed" Steven Rostedt
2020-01-24 15:17 ` [for-next][PATCH 10/14] ring-buffer: Remove abandoned macro RB_MISSED_FLAGS Steven Rostedt
2020-01-24 15:17 ` [for-next][PATCH 11/14] tracing: Remove unused TRACE_SEQ_BUF_USED Steven Rostedt
2020-01-24 15:17 ` [for-next][PATCH 12/14] tracing/boot: Fix an IS_ERR() vs NULL bug Steven Rostedt
2020-01-24 15:17 ` Steven Rostedt [this message]
2020-01-24 15:17 ` [for-next][PATCH 14/14] trace/kprobe: Remove unused MAX_KPROBE_CMDLINE_SIZE Steven Rostedt

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=20200124151726.137118966@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=mingo@kernel.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).