All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anton Vorontsov <anton.vorontsov@linaro.org>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Kees Cook <keescook@chromium.org>,
	Colin Cross <ccross@android.com>, Tony Luck <tony.luck@intel.com>,
	Steven Rostedt <rostedt@goodmis.org>,
	Frederic Weisbecker <fweisbec@gmail.com>,
	Ingo Molnar <mingo@redhat.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	John Stultz <john.stultz@linaro.org>,
	Shuah Khan <shuahkhan@gmail.com>,
	arve@android.com, Rebecca Schultz Zavin <rebecca@android.com>,
	Jesper Juhl <jj@chaosbits.net>,
	Randy Dunlap <rdunlap@xenotime.net>,
	Stephen Boyd <sboyd@codeaurora.org>,
	Thomas Meyer <thomas@m3y3r.de>,
	Andrew Morton <akpm@linux-foundation.org>,
	Marco Stornelli <marco.stornelli@gmail.com>,
	WANG Cong <xiyou.wangcong@gmail.com>,
	linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org,
	linaro-kernel@lists.linaro.org, patches@linaro.org,
	kernel-team@android.com
Subject: [PATCH 1/7] tracing: Fix initialization failure path in tracing_set_tracer()
Date: Tue, 26 Jun 2012 16:23:23 -0700	[thread overview]
Message-ID: <1340753009-12483-1-git-send-email-anton.vorontsov@linaro.org> (raw)
In-Reply-To: <20120626232210.GA11549@lizard>

If tracer->init() fails, current code will leave current_tracer pointing
to an unusable tracer, which at best makes 'current_tracer' report
inaccurate value.

Fix the issue by pointing current_tracer to nop tracer, and only update
current_tracer with the new one after all the initialization succeeds.

Signed-off-by: Anton Vorontsov <anton.vorontsov@linaro.org>
Acked-by: Steven Rostedt <rostedt@goodmis.org>
---
 kernel/trace/trace.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c
index a7fa070..7647d33 100644
--- a/kernel/trace/trace.c
+++ b/kernel/trace/trace.c
@@ -3172,10 +3172,10 @@ static int tracing_set_tracer(const char *buf)
 	}
 	destroy_trace_option_files(topts);
 
-	current_trace = t;
+	current_trace = &nop_trace;
 
-	topts = create_trace_option_files(current_trace);
-	if (current_trace->use_max_tr) {
+	topts = create_trace_option_files(t);
+	if (t->use_max_tr) {
 		int cpu;
 		/* we need to make per cpu buffer sizes equivalent */
 		for_each_tracing_cpu(cpu) {
@@ -3195,6 +3195,7 @@ static int tracing_set_tracer(const char *buf)
 			goto out;
 	}
 
+	current_trace = t;
 	trace_branch_enable(tr);
  out:
 	mutex_unlock(&trace_types_lock);
-- 
1.7.10.4


  reply	other threads:[~2012-06-26 23:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-26 23:22 [PATCH v3 0/7] Function tracing support for pstore Anton Vorontsov
2012-06-26 23:23 ` Anton Vorontsov [this message]
2012-06-26 23:23 ` [PATCH 2/7] pstore: Introduce write_buf backend callback Anton Vorontsov
2012-06-26 23:23 ` [PATCH 3/7] pstore: Add persistent function tracing Anton Vorontsov
2012-06-26 23:23 ` [PATCH 4/7] tracing/function: Introduce persistent trace option Anton Vorontsov
2012-06-27 12:40   ` Steven Rostedt
2012-07-09 23:44     ` Anton Vorontsov
2012-06-26 23:23 ` [PATCH 5/7] pstore/ram: Convert to write_buf callback Anton Vorontsov
2012-06-26 23:23 ` [PATCH 6/7] pstore/ram: Add ftrace messages handling Anton Vorontsov
2012-06-26 23:23 ` [PATCH 7/7] pstore/ram: Make tracing log versioned Anton Vorontsov

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=1340753009-12483-1-git-send-email-anton.vorontsov@linaro.org \
    --to=anton.vorontsov@linaro.org \
    --cc=akpm@linux-foundation.org \
    --cc=arnd@arndb.de \
    --cc=arve@android.com \
    --cc=ccross@android.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=fweisbec@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jj@chaosbits.net \
    --cc=john.stultz@linaro.org \
    --cc=keescook@chromium.org \
    --cc=kernel-team@android.com \
    --cc=linaro-kernel@lists.linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marco.stornelli@gmail.com \
    --cc=mingo@redhat.com \
    --cc=patches@linaro.org \
    --cc=rdunlap@xenotime.net \
    --cc=rebecca@android.com \
    --cc=rostedt@goodmis.org \
    --cc=sboyd@codeaurora.org \
    --cc=shuahkhan@gmail.com \
    --cc=thomas@m3y3r.de \
    --cc=tony.luck@intel.com \
    --cc=xiyou.wangcong@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.