From: Frederic Weisbecker <fweisbec@gmail.com>
To: Peter Zijlstra <peterz@infradead.org>
Cc: Avi Kivity <avi@redhat.com>, Li Zefan <lizf@cn.fujitsu.com>,
Ingo Molnar <mingo@elte.hu>, Steven Rostedt <rostedt@goodmis.org>,
kvm-devel <kvm@vger.kernel.org>,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: ftrace/perf_event leak
Date: Wed, 1 Sep 2010 14:15:20 +0200 [thread overview]
Message-ID: <20100901121518.GA5378@nowhere> (raw)
In-Reply-To: <1283338977.2059.938.camel@laptop>
On Wed, Sep 01, 2010 at 01:02:57PM +0200, Peter Zijlstra wrote:
> On Wed, 2010-09-01 at 13:38 +0300, Avi Kivity wrote:
> > On 09/01/2010 12:38 PM, Li Zefan wrote:
> > >
> > > Then try this:
> >
> > Tested-by: Avi Kivity <avi@redhat.com>
> >
>
> Thanks, queued as:
>
> ---
> Subject: perf, trace: Fix module leak
> From: Li Zefan <lizf@cn.fujitsu.com>
> Date: Wed Sep 01 12:58:43 CEST 2010
>
> Commit 1c024eca (perf, trace: Optimize tracepoints by using
> per-tracepoint-per-cpu hlist to track events) caused a module refcount
> leak.
>
> Tested-by: Avi Kivity <avi@redhat.com>
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
> LKML-Reference: <4C7E1F12.8030304@cn.fujitsu.com>
> ---
> kernel/trace/trace_event_perf.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> 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);
> }
>
>
Thanks for fixing this.
However, can we split this in two patches to ease the backport?
The lack of a module_put() after perf_trace_init() failure is there for a while
(the backport needs to start in 2.6.32).
But the lack of a module_put in the destroy path needs a .35 backport only.
next prev parent reply other threads:[~2010-09-01 12:15 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-01 8:42 ftrace/perf_event leak Avi Kivity
2010-09-01 9:04 ` Peter Zijlstra
2010-09-01 9:26 ` Avi Kivity
2010-09-01 9:35 ` Peter Zijlstra
2010-09-01 9:38 ` Li Zefan
2010-09-01 9:41 ` Peter Zijlstra
2010-09-01 10:38 ` Avi Kivity
2010-09-01 11:02 ` Peter Zijlstra
2010-09-01 11:07 ` Ingo Molnar
2010-09-01 12:15 ` Frederic Weisbecker [this message]
2010-09-01 13:59 ` Steven Rostedt
2010-09-01 17:32 ` Ingo Molnar
2010-09-02 1:20 ` Li Zefan
2010-09-09 19:45 ` [tip:perf/core] perf, trace: Fix module leak tip-bot for Li Zefan
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=20100901121518.GA5378@nowhere \
--to=fweisbec@gmail.com \
--cc=avi@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lizf@cn.fujitsu.com \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--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