Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758098Ab2FOWAF (ORCPT ); Fri, 15 Jun 2012 18:00:05 -0400 Received: from hrndva-omtalb.mail.rr.com ([71.74.56.122]:30744 "EHLO hrndva-omtalb.mail.rr.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757323Ab2FOWAD (ORCPT ); Fri, 15 Jun 2012 18:00:03 -0400 X-Authority-Analysis: v=2.0 cv=NbpkJh/4 c=1 sm=0 a=ZycB6UtQUfgMyuk2+PxD7w==:17 a=XQbtiDEiEegA:10 a=_QGJrvNiojYA:10 a=5SG0PmZfjMsA:10 a=Q9fys5e9bTEA:10 a=meVymXHHAAAA:8 a=ayC55rCoAAAA:8 a=KKAkSRfTAAAA:8 a=tMn7H1j0pZg76wYNDCgA:9 a=PUjeQqilurYA:10 a=WwgC8nHKvroA:10 a=jeBq3FmKZ4MA:10 a=ZycB6UtQUfgMyuk2+PxD7w==:117 X-Cloudmark-Score: 0 X-Originating-IP: 74.67.80.29 Message-ID: <1339797600.25903.9.camel@gandalf.stny.rr.com> Subject: Re: [PATCH 1/6] tracing: Fix initialization failure path in tracing_set_tracer() From: Steven Rostedt To: Anton Vorontsov Cc: Greg Kroah-Hartman , Kees Cook , Colin Cross , Tony Luck , Frederic Weisbecker , Ingo Molnar , Arnd Bergmann , John Stultz , Shuah Khan , arve@android.com, Rebecca Schultz Zavin , Jesper Juhl , Randy Dunlap , Stephen Boyd , Thomas Meyer , Andrew Morton , Marco Stornelli , WANG Cong , linux-kernel@vger.kernel.org, devel@driverdev.osuosl.org, linaro-kernel@lists.linaro.org, patches@linaro.org, kernel-team@android.com Date: Fri, 15 Jun 2012 18:00:00 -0400 In-Reply-To: <1339780111-12075-1-git-send-email-anton.vorontsov@linaro.org> References: <20120615170659.GA4060@lizard> <1339780111-12075-1-git-send-email-anton.vorontsov@linaro.org> Content-Type: text/plain; charset="ISO-8859-15" X-Mailer: Evolution 3.2.2-1+b1 Content-Transfer-Encoding: 7bit Mime-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1631 Lines: 51 On Fri, 2012-06-15 at 10:08 -0700, Anton Vorontsov wrote: > 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 Acked-by: Steven Rostedt -- Steve > --- > 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); -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/