From patchwork Wed Sep 1 11:02:57 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Peter Zijlstra X-Patchwork-Id: 146721 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id o81B44RT021413 for ; Wed, 1 Sep 2010 11:04:43 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754750Ab0IALDe (ORCPT ); Wed, 1 Sep 2010 07:03:34 -0400 Received: from casper.infradead.org ([85.118.1.10]:51875 "EHLO casper.infradead.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753832Ab0IALDd convert rfc822-to-8bit (ORCPT ); Wed, 1 Sep 2010 07:03:33 -0400 Received: from f199130.upc-f.chello.nl ([80.56.199.130] helo=laptop) by casper.infradead.org with esmtpsa (Exim 4.72 #1 (Red Hat Linux)) id 1Oql5q-0005yo-2A; Wed, 01 Sep 2010 11:03:03 +0000 Received: by laptop (Postfix, from userid 1000) id DA1AE107D6EB0; Wed, 1 Sep 2010 13:02:57 +0200 (CEST) Subject: Re: ftrace/perf_event leak From: Peter Zijlstra To: Avi Kivity Cc: Li Zefan , Ingo Molnar , Frederic Weisbecker , Steven Rostedt , kvm-devel , Linux Kernel Mailing List In-Reply-To: <4C7E2D1D.3080603@redhat.com> References: <4C7E11E5.1040402@redhat.com> <1283331868.2059.808.camel@laptop> <4C7E1C36.6070400@redhat.com> <4C7E1F12.8030304@cn.fujitsu.com> <4C7E2D1D.3080603@redhat.com> Date: Wed, 01 Sep 2010 13:02:57 +0200 Message-ID: <1283338977.2059.938.camel@laptop> Mime-Version: 1.0 X-Mailer: Evolution 2.28.3 Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter1.kernel.org [140.211.167.41]); Wed, 01 Sep 2010 11:04:43 +0000 (UTC) Index: linux-2.6/kernel/trace/trace_event_perf.c =================================================================== --- linux-2.6.orig/kernel/trace/trace_event_perf.c +++ linux-2.6/kernel/trace/trace_event_perf.c @@ -91,6 +91,8 @@ int perf_trace_init(struct perf_event *p tp_event->class && tp_event->class->reg && try_module_get(tp_event->mod)) { ret = perf_trace_event_init(tp_event, p_event); + if (ret) + module_put(tp_event->mod); break; } } @@ -147,6 +149,7 @@ void perf_trace_destroy(struct perf_even } } out: + module_put(tp_event->mod); mutex_unlock(&event_mutex); }